-
Notifications
You must be signed in to change notification settings - Fork 11
stream end events miss streams closed by the client #510
Description
It turns out that the Tor code that emits PrivCount events only emits a PRIVCOUNT_STREAM_ENDED event in the case that the exit relay sends a relay end cell toward the client to notify it that the stream closed. This happens if the server closes the server side of the exit connection, or if the server and client close their respective connections at roughly the same time. But the exit does not send a relay end cell if the client closes the connection first, i.e., if the exit receives a relay end cell from the client before the server-side exit connection is closed.
If we want to count all stream events, we should add some code to Tor to connection.c, near the same place that control_event_privcount_connection() is currently called. We could add something like:
if (conn->type == CONN_TYPE_EXIT) {
control_event_privcount_stream_closed(TO_EXIT_CONN(conn));
}
I think this will count all exit connections. I suggest that this counter be called PRIVCOUNT_STREAM_CLOSED.