mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-02 16:43:32 +01:00
fix subtle race condition
If you weren't connected to a given router, and you made a directory request to it simultaneously with a new web query that caused you to want to connect to that OR... it would think you're already connected. svn:r135
This commit is contained in:
parent
84a34edfa1
commit
121d029584
@ -37,7 +37,8 @@ void directory_initiate_fetch(routerinfo_t *router) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* set up conn so it's got all the data we need to remember */
|
/* set up conn so it's got all the data we need to remember */
|
||||||
conn->addr = router->addr, conn->port = router->or_port; /* NOTE we store or_port here always */
|
conn->addr = router->addr;
|
||||||
|
conn->port = router->dir_port;
|
||||||
conn->address = strdup(router->address);
|
conn->address = strdup(router->address);
|
||||||
conn->receiver_bucket = -1; /* edge connections don't do receiver buckets */
|
conn->receiver_bucket = -1; /* edge connections don't do receiver buckets */
|
||||||
conn->bandwidth = -1;
|
conn->bandwidth = -1;
|
||||||
@ -279,7 +280,7 @@ int connection_dir_create_listener(struct sockaddr_in *bindaddr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int connection_dir_handle_listener_read(connection_t *conn) {
|
int connection_dir_handle_listener_read(connection_t *conn) {
|
||||||
log(LOG_NOTICE,"Dir: Received a connection request. Waiting for command.");
|
log(LOG_INFO,"Dir: Received a connection request. Waiting for command.");
|
||||||
return connection_handle_listener_read(conn, CONN_TYPE_DIR, DIR_CONN_STATE_COMMAND_WAIT);
|
return connection_handle_listener_read(conn, CONN_TYPE_DIR, DIR_CONN_STATE_COMMAND_WAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user