all listeners listen on 0.0.0.0 except AP which listens on 127.0.0.1

svn:r126
This commit is contained in:
Roger Dingledine 2002-10-02 01:03:00 +00:00
parent 7ed6c8bd39
commit b3b763ad11

View File

@ -279,11 +279,12 @@ int retry_all_connections(int role, uint16_t or_listenport,
return -1; return -1;
local.sin_port = htons(or_listenport); local.sin_port = htons(or_listenport);
if(role & ROLE_OR_CONNECT_ALL) { if(role & ROLE_OR_CONNECT_ALL) {
router_retry_connections(&local); router_retry_connections(&local);
} }
local.sin_addr.s_addr = htonl(INADDR_ANY); /* anyone can connect */
if(role & ROLE_OR_LISTEN) { if(role & ROLE_OR_LISTEN) {
if(!connection_get_by_type(CONN_TYPE_OR_LISTENER)) { if(!connection_get_by_type(CONN_TYPE_OR_LISTENER)) {
connection_or_create_listener(&local); 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) { if(role & ROLE_DIR_LISTEN) {
local.sin_port = htons(dir_listenport); local.sin_port = htons(dir_listenport);
if(!connection_get_by_type(CONN_TYPE_DIR_LISTENER)) { 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; return 0;
} }