comparison ngx_http_upstream_keepalive_module.c @ 24:2ee28064a04a 0.4

Keepalive: correctly close connections on gracefull shutdown. On gracefull shutdown nginx calls read handler on all idle connections with c->close set. Make sure we don't confuse such read handler calls with stale events and actually close connections. This fixes "open socket ... left in connection ..." alerts.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 15 Dec 2010 21:12:36 +0300
parents 9a4ee6fe1c6d
children cb15f6f4d820
comparison
equal deleted inserted replaced
23:cad8bc39d98d 24:2ee28064a04a
393 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ev->log, 0, 393 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ev->log, 0,
394 "keepalive close handler"); 394 "keepalive close handler");
395 395
396 c = ev->data; 396 c = ev->data;
397 397
398 if (c->close) {
399 goto close;
400 }
401
398 n = recv(c->fd, buf, 1, MSG_PEEK); 402 n = recv(c->fd, buf, 1, MSG_PEEK);
399 403
400 if (n == -1 && ngx_socket_errno == NGX_EAGAIN) { 404 if (n == -1 && ngx_socket_errno == NGX_EAGAIN) {
401 /* stale event */ 405 /* stale event */
402 406