diff --git a/src/or/connection.c b/src/or/connection.c index f8333c0ade..bdb8802531 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -279,11 +279,12 @@ int retry_all_connections(int role, uint16_t or_listenport, return -1; local.sin_port = htons(or_listenport); - if(role & ROLE_OR_CONNECT_ALL) { router_retry_connections(&local); } + local.sin_addr.s_addr = htonl(INADDR_ANY); /* anyone can connect */ + if(role & ROLE_OR_LISTEN) { if(!connection_get_by_type(CONN_TYPE_OR_LISTENER)) { connection_or_create_listener(&local); @@ -297,13 +298,6 @@ int retry_all_connections(int role, uint16_t or_listenport, } } - if(role & ROLE_AP_LISTEN) { - local.sin_port = htons(ap_listenport); - if(!connection_get_by_type(CONN_TYPE_AP_LISTENER)) { - connection_ap_create_listener(&local); - } - } - if(role & ROLE_DIR_LISTEN) { local.sin_port = htons(dir_listenport); if(!connection_get_by_type(CONN_TYPE_DIR_LISTENER)) { @@ -311,6 +305,14 @@ int retry_all_connections(int role, uint16_t or_listenport, } } + if(role & ROLE_AP_LISTEN) { + local.sin_port = htons(ap_listenport); + inet_aton("127.0.0.1", &(local.sin_addr)); /* the AP listens only on localhost! */ + if(!connection_get_by_type(CONN_TYPE_AP_LISTENER)) { + connection_ap_create_listener(&local); + } + } + return 0; }