From: Dante Date: Tue, 15 Sep 2009 21:03:21 +0000 (+0200) Subject: Stop processing packets when the socket is closed. X-Git-Tag: release_3_0_0_beta0~1745 X-Git-Url: http://www.project-moonshot.org/gitweb/?a=commitdiff_plain;h=97af9a0ec7994f0e6ef01d8d6785d613f56ce181;p=freeradius.git Stop processing packets when the socket is closed. If the socket from the client, or to the proxy is closed, then handle that situation. Signed-off-by: Alan T. DeKok --- diff --git a/src/main/event.c b/src/main/event.c index b14b84a..e39811a 100644 --- a/src/main/event.c +++ b/src/main/event.c @@ -1082,6 +1082,14 @@ static void wait_a_bit(void *ctx) rad_assert(request->magic == REQUEST_MAGIC); + /* + * The socket was closed. Tell the request that + * there is no point in continuing. + */ + if (request->listener->status != RAD_LISTEN_STATUS_KNOWN) { + goto stop_processing; + } + #ifdef WITH_COA /* * The CoA request is a new (internally generated) @@ -1167,6 +1175,7 @@ static void wait_a_bit(void *ctx) request->component ? request->component : ""); } + stop_processing: request->master_state = REQUEST_STOP_PROCESSING; request->delay = USEC / 4; @@ -1174,6 +1183,8 @@ static void wait_a_bit(void *ctx) callback = wait_for_child_to_die; break; } +#else /* no child threads */ + stop_processing: #endif /* @@ -2522,11 +2533,13 @@ static void received_retransmit(REQUEST *request, const RADCLIENT *client) check_for_zombie_home_server(request); /* - * If we've just discovered that the home server is - * dead, send the packet to another one. + * If we've just discovered that the home server + * is dead, OR the socket has been closed, look for + * another connection to a home server. */ - if ((request->packet->dst_port != 0) && - (request->home_server->state == HOME_STATE_IS_DEAD)) { + if (((request->packet->dst_port != 0) && + (request->home_server->state == HOME_STATE_IS_DEAD)) || + (request->proxy_listener->status != RAD_LISTEN_STATUS_KNOWN)) { home_server *home; remove_from_proxy_hash(request); @@ -3609,6 +3622,8 @@ int radius_event_init(CONF_SECTION *cs, int spawn_flag) } event_new_fd(this); + + this->status = RAD_LISTEN_STATUS_KNOWN; } mainconfig.listen = head;