comparison src/os/unix/ngx_recv.c @ 136:3656228c0b56 NGINX_0_3_15

nginx 0.3.15 *) Feature: the new 444 code of the "return" directive to close connection. *) Feature: the "so_keepalive" directive in IMAP/POP3 proxy. *) Bugfix: if there are unclosed connection nginx now calls abort() only on gracefull quit and active "debug_points" directive.
author Igor Sysoev <http://sysoev.ru>
date Wed, 07 Dec 2005 00:00:00 +0300
parents 91372f004adf
children bb61aa162c6b
comparison
equal deleted inserted replaced
135:c1ac76c0e9df 136:3656228c0b56
23 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0, 23 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, c->log, 0,
24 "recv: eof:%d, avail:%d, err:%d", 24 "recv: eof:%d, avail:%d, err:%d",
25 rev->pending_eof, rev->available, rev->kq_errno); 25 rev->pending_eof, rev->available, rev->kq_errno);
26 26
27 if (rev->available == 0) { 27 if (rev->available == 0) {
28 28 if (rev->pending_eof) {
29 if (!rev->pending_eof) {
30 return NGX_AGAIN;
31 }
32
33 /* FreeBSD 5.x-6.x may erroneously report ETIMEDOUT */
34 if (rev->kq_errno != NGX_ETIMEDOUT) {
35
36 rev->ready = 0; 29 rev->ready = 0;
37 rev->eof = 1; 30 rev->eof = 1;
38 31
39 if (rev->kq_errno) { 32 if (rev->kq_errno) {
40 rev->error = 1; 33 rev->error = 1;
43 return ngx_connection_error(c, rev->kq_errno, 36 return ngx_connection_error(c, rev->kq_errno,
44 "kevent() reported about an closed connection"); 37 "kevent() reported about an closed connection");
45 } 38 }
46 39
47 return 0; 40 return 0;
41
42 } else {
43 return NGX_AGAIN;
48 } 44 }
49 } 45 }
50 } 46 }
51 47
52 do { 48 do {
59 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) { 55 if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
60 rev->available -= n; 56 rev->available -= n;
61 57
62 /* 58 /*
63 * rev->available may be negative here because some additional 59 * rev->available may be negative here because some additional
64 * bytes can be received between kevent() and recv() 60 * bytes may be received between kevent() and recv()
65 */ 61 */
66 62
67 if (rev->available <= 0) { 63 if (rev->available <= 0) {
68 if (!rev->pending_eof) { 64 if (!rev->pending_eof) {
69 rev->ready = 0; 65 rev->ready = 0;