comparison src/event/ngx_event_write.c @ 44:0e81ac0bb3e2

nginx-0.0.1-2003-01-09-08:36:00 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 09 Jan 2003 05:36:00 +0000
parents 53cb81681040
children e8cdc2989cee
comparison
equal deleted inserted replaced
43:53cd05892261 44:0e81ac0bb3e2
100 } else { 100 } else {
101 rc = ngx_sendv(c, (ngx_iovec_t *) header->elts, header->nelts); 101 rc = ngx_sendv(c, (ngx_iovec_t *) header->elts, header->nelts);
102 102
103 sent = rc > 0 ? rc: 0; 103 sent = rc > 0 ? rc: 0;
104 104
105 #if (NGX_DEBUG_EVENT_WRITE)
105 ngx_log_debug(c->log, "sendv: " QD_FMT _ sent); 106 ngx_log_debug(c->log, "sendv: " QD_FMT _ sent);
107 #endif
106 } 108 }
107 #if (HAVE_MAX_SENDFILE_IOVEC) 109 #if (HAVE_MAX_SENDFILE_IOVEC)
108 } 110 }
109 #endif 111 #endif
110 if (rc == NGX_ERROR) 112 if (rc == NGX_ERROR)
113 c->sent += sent; 115 c->sent += sent;
114 flush -= sent; 116 flush -= sent;
115 117
116 for (ch = in; ch; ch = ch->next) { 118 for (ch = in; ch; ch = ch->next) {
117 119
118 ngx_log_debug(c->log, "ch event write: %x %qx %qd" _ 120 #if (NGX_DEBUG_EVENT_WRITE)
121 ngx_log_debug(c->log, "event write: %x " QX_FMT " " QD_FMT _
119 ch->hunk->type _ 122 ch->hunk->type _
120 ch->hunk->pos.file _ 123 ch->hunk->pos.file _
121 ch->hunk->last.file - ch->hunk->pos.file); 124 ch->hunk->last.file - ch->hunk->pos.file);
125 #endif
122 126
123 if (sent >= ch->hunk->last.file - ch->hunk->pos.file) { 127 if (sent >= ch->hunk->last.file - ch->hunk->pos.file) {
124 sent -= ch->hunk->last.file - ch->hunk->pos.file; 128 sent -= ch->hunk->last.file - ch->hunk->pos.file;
125 ch->hunk->pos.file = ch->hunk->last.file; 129 ch->hunk->pos.file = ch->hunk->last.file;
126 130
131 #if (NGX_DEBUG_EVENT_WRITE)
127 ngx_log_debug(c->log, "event write: " QX_FMT " 0 " QD_FMT _ 132 ngx_log_debug(c->log, "event write: " QX_FMT " 0 " QD_FMT _
128 ch->hunk->pos.file _ sent); 133 ch->hunk->pos.file _ sent);
134 #endif
129 135
130 /* 136 /*
131 if (ch->hunk->type & NGX_HUNK_LAST) 137 if (ch->hunk->type & NGX_HUNK_LAST)
132 break; 138 break;
133 */ 139 */
135 continue; 141 continue;
136 } 142 }
137 143
138 ch->hunk->pos.file += sent; 144 ch->hunk->pos.file += sent;
139 145
140 ngx_log_debug(c->log, "event write: %qx %qd" _ 146 #if (NGX_DEBUG_EVENT_WRITE)
147 ngx_log_debug(c->log, "event write: " QX_FMT " " QD_FMT _
141 ch->hunk->pos.file _ 148 ch->hunk->pos.file _
142 ch->hunk->last.file - ch->hunk->pos.file); 149 ch->hunk->last.file - ch->hunk->pos.file);
150 #endif
143 151
144 break; 152 break;
145 } 153 }
146 154
147 /* flush hunks if threaded state */ 155 /* flush hunks if threaded state */