comparison src/event/ngx_event_write.c @ 3:34a521b1a148

nginx-0.0.1-2002-08-20-18:48:28 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 20 Aug 2002 14:48:28 +0000
parents d220029ac7f3
children 708f8bb772ec
comparison
equal deleted inserted replaced
2:ffffe1499bce 3:34a521b1a148
97 (ngx_iovec_t *) trailer->elts, trailer->nelts, 97 (ngx_iovec_t *) trailer->elts, trailer->nelts,
98 &sent, cn->log); 98 &sent, cn->log);
99 } else { 99 } else {
100 rc = ngx_sendv(cn->fd, (ngx_iovec_t *) header->elts, 100 rc = ngx_sendv(cn->fd, (ngx_iovec_t *) header->elts,
101 header->nelts, (size_t *) &sent); 101 header->nelts, (size_t *) &sent);
102 ngx_log_debug(cn->log, "sendv: %d" _ sent);
102 } 103 }
103 #if (HAVE_MAX_SENDFILE_IOVEC) 104 #if (HAVE_MAX_SENDFILE_IOVEC)
104 } 105 }
105 #endif 106 #endif
106 /* save sent for logging */ 107 /* save sent for logging */
108 if (rc == -1) 109 if (rc == -1)
109 return (ngx_chain_t *) -1; 110 return (ngx_chain_t *) -1;
110 111
111 flush -= sent; 112 flush -= sent;
112 113
113 for (ch = in; ch && !(ch->hunk->type & NGX_HUNK_LAST); ch = ch->next) { 114 for (ch = in; ch; ch = ch->next) {
114 if (sent >= ch->hunk->last.file - ch->hunk->pos.file) { 115 if (sent >= ch->hunk->last.file - ch->hunk->pos.file) {
115 sent -= ch->hunk->last.file - ch->hunk->pos.file; 116 sent -= ch->hunk->last.file - ch->hunk->pos.file;
116 ch->hunk->last.file = ch->hunk->pos.file; 117 ch->hunk->last.file = ch->hunk->pos.file;
117 continue; 118
119 ngx_log_debug(cn->log, "event write: %qx 0" _
120 ch->hunk->pos.file);
121
122 if (ch->hunk->type & NGX_HUNK_LAST)
123 break;
124
125 continue;
118 } 126 }
119 127
120 ch->hunk->pos.file += sent; 128 ch->hunk->pos.file += sent;
129
130 ngx_log_debug(cn->log, "event write: %qx %qd" _
131 ch->hunk->pos.file _
132 ch->hunk->last.file - ch->hunk->pos.file);
133
121 break; 134 break;
122 } 135 }
123 136
124 /* flush hunks if threaded state */ 137 /* flush hunks if threaded state */
125 } while (cn->write->context && flush > 0); 138 } while (cn->write->context && flush > 0);