Mercurial > hg > nginx
diff src/event/ngx_event_connect.c @ 323:ba876b26b76d
nginx-0.0.3-2004-04-21-22:54:33 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 21 Apr 2004 18:54:33 +0000 |
parents | 2e899477243a |
children | e366ba5db8f8 |
line wrap: on
line diff
--- a/src/event/ngx_event_connect.c Tue Apr 20 07:00:43 2004 +0000 +++ b/src/event/ngx_event_connect.c Wed Apr 21 18:54:33 2004 +0000 @@ -19,6 +19,7 @@ ngx_socket_t s; ngx_event_t *rev, *wev; ngx_connection_t *c; + ngx_event_conf_t *ecf; struct sockaddr_in addr; now = ngx_time(); @@ -103,6 +104,29 @@ return NGX_ERROR; } + + ecf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_event_core_module); + + /* disable warning: Win32 SOCKET is u_int while UNIX socket is int */ + + if ((ngx_uint_t) s >= ecf->connections) { + + ngx_log_error(NGX_LOG_ALERT, pc->log, 0, + "socket() returned socket #%d while only %d " + "connections was configured, closing the socket", + s, ecf->connections); + + if (ngx_close_socket(s) == -1) { + ngx_log_error(NGX_LOG_ALERT, pc->log, ngx_socket_errno, + ngx_close_socket_n "failed"); + } + + /* TODO: sleep for some time */ + + return NGX_ERROR; + } + + if (pc->rcvbuf) { if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, (const void *) &pc->rcvbuf, sizeof(int)) == -1) {