|
@@ -563,6 +563,7 @@ connection_init(time_t now, connection_t *conn, int type, int socket_family)
|
|
|
}
|
|
|
|
|
|
conn->s = TOR_INVALID_SOCKET; /* give it a default of 'not used' */
|
|
|
+ conn->scheduler_socket_cache = conn->s;
|
|
|
conn->conn_array_index = -1; /* also default to 'not used' */
|
|
|
conn->global_identifier = n_connections_allocated++;
|
|
|
|
|
@@ -804,6 +805,8 @@ connection_free_minimal(connection_t *conn)
|
|
|
conn->s = TOR_INVALID_SOCKET;
|
|
|
}
|
|
|
|
|
|
+ conn->scheduler_socket_cache = TOR_INVALID_SOCKET;
|
|
|
+
|
|
|
if (conn->type == CONN_TYPE_OR &&
|
|
|
!tor_digest_is_zero(TO_OR_CONN(conn)->identity_digest)) {
|
|
|
log_warn(LD_BUG, "called on OR conn with non-zeroed identity_digest");
|
|
@@ -930,6 +933,7 @@ connection_close_immediate(connection_t *conn)
|
|
|
if (SOCKET_OK(conn->s))
|
|
|
tor_close_socket(conn->s);
|
|
|
conn->s = TOR_INVALID_SOCKET;
|
|
|
+ conn->scheduler_socket_cache = TOR_INVALID_SOCKET;
|
|
|
if (conn->linked)
|
|
|
conn->linked_conn_is_closed = 1;
|
|
|
if (conn->outbuf)
|
|
@@ -1885,6 +1889,8 @@ connection_handle_listener_read(connection_t *conn, int new_type)
|
|
|
newconn->address = tor_addr_to_str_dup(&addr);
|
|
|
}
|
|
|
|
|
|
+ newconn->scheduler_socket_cache = news;
|
|
|
+
|
|
|
if (!connection_uses_safe_conn(newconn->type)) {
|
|
|
newconn->s = news;
|
|
|
} else {
|
|
@@ -1938,6 +1944,7 @@ connection_handle_listener_read(connection_t *conn, int new_type)
|
|
|
|
|
|
newconn = connection_new(new_type, conn->socket_family);
|
|
|
newconn->s = news;
|
|
|
+ newconn->scheduler_socket_cache = news;
|
|
|
|
|
|
/* remember the remote address -- do we have anything sane to put here? */
|
|
|
tor_addr_make_unspec(&newconn->addr);
|
|
@@ -2147,6 +2154,8 @@ connection_connect_sockaddr,(connection_t *conn,
|
|
|
"Connection to socket %s (sock "TOR_SOCKET_T_FORMAT").",
|
|
|
inprogress ? "in progress" : "established", s);
|
|
|
|
|
|
+ conn->scheduler_socket_cache = s;
|
|
|
+
|
|
|
if (!connection_uses_safe_conn(conn->type)) {
|
|
|
conn->s = s;
|
|
|
} else {
|