Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_timewait.c
Show First 20 Lines • Show All 269 Lines • ▼ Show 20 Lines | if (local) | ||||
tw = &twlocal; | tw = &twlocal; | ||||
else | else | ||||
tw = uma_zalloc(V_tcptw_zone, M_NOWAIT); | tw = uma_zalloc(V_tcptw_zone, M_NOWAIT); | ||||
if (tw == NULL) { | if (tw == NULL) { | ||||
/* | /* | ||||
* Reached limit on total number of TIMEWAIT connections | * Reached limit on total number of TIMEWAIT connections | ||||
* allowed. Remove a connection from TIMEWAIT queue in LRU | * allowed. Remove a connection from TIMEWAIT queue in LRU | ||||
* fashion to make room for this connection. | * fashion to make room for this connection. | ||||
* If that fails, use on stack tw at least to be able to | |||||
* run through tcp_twrespond() and standard tcpcb discard | |||||
* routine. | |||||
* | * | ||||
* XXX: Check if it possible to always have enough room | * XXX: Check if it possible to always have enough room | ||||
* in advance based on guarantees provided by uma_zalloc(). | * in advance based on guarantees provided by uma_zalloc(). | ||||
*/ | */ | ||||
tw = tcp_tw_2msl_scan(1); | tw = tcp_tw_2msl_scan(1); | ||||
if (tw == NULL) { | if (tw == NULL) { | ||||
tp = tcp_close(tp); | tw = &twlocal; | ||||
if (tp != NULL) | local = true; | ||||
INP_WUNLOCK(inp); | |||||
return; | |||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* For !local case the tcptw will hold a reference on its inpcb | * For !local case the tcptw will hold a reference on its inpcb | ||||
* until tcp_twclose is called. | * until tcp_twclose is called. | ||||
*/ | */ | ||||
tw->tw_inpcb = inp; | tw->tw_inpcb = inp; | ||||
▲ Show 20 Lines • Show All 546 Lines • Show Last 20 Lines |