comparison src/mail/ngx_mail_auth_http_module.c @ 1478:d0cce8369848

small optimizations
author Igor Sysoev <igor@sysoev.ru>
date Thu, 13 Sep 2007 20:32:52 +0000
parents 59e1caf2be94
children f69493e8faab
comparison
equal deleted inserted replaced
1477:59e1caf2be94 1478:d0cce8369848
250 "mail auth http write handler"); 250 "mail auth http write handler");
251 251
252 if (wev->timedout) { 252 if (wev->timedout) {
253 ngx_log_error(NGX_LOG_ERR, wev->log, NGX_ETIMEDOUT, 253 ngx_log_error(NGX_LOG_ERR, wev->log, NGX_ETIMEDOUT,
254 "auth http server %V timed out", ctx->peer.name); 254 "auth http server %V timed out", ctx->peer.name);
255 ngx_close_connection(ctx->peer.connection); 255 ngx_close_connection(c);
256 ngx_destroy_pool(ctx->pool); 256 ngx_destroy_pool(ctx->pool);
257 ngx_mail_session_internal_server_error(s); 257 ngx_mail_session_internal_server_error(s);
258 return; 258 return;
259 } 259 }
260 260
261 size = ctx->request->last - ctx->request->pos; 261 size = ctx->request->last - ctx->request->pos;
262 262
263 n = ngx_send(c, ctx->request->pos, size); 263 n = ngx_send(c, ctx->request->pos, size);
264 264
265 if (n == NGX_ERROR) { 265 if (n == NGX_ERROR) {
266 ngx_close_connection(ctx->peer.connection); 266 ngx_close_connection(c);
267 ngx_destroy_pool(ctx->pool); 267 ngx_destroy_pool(ctx->pool);
268 ngx_mail_session_internal_server_error(s); 268 ngx_mail_session_internal_server_error(s);
269 return; 269 return;
270 } 270 }
271 271
278 if (wev->timer_set) { 278 if (wev->timer_set) {
279 ngx_del_timer(wev); 279 ngx_del_timer(wev);
280 } 280 }
281 281
282 if (ngx_handle_write_event(wev, 0) == NGX_ERROR) { 282 if (ngx_handle_write_event(wev, 0) == NGX_ERROR) {
283 ngx_close_connection(ctx->peer.connection); 283 ngx_close_connection(c);
284 ngx_destroy_pool(ctx->pool); 284 ngx_destroy_pool(ctx->pool);
285 ngx_mail_session_internal_server_error(s); 285 ngx_mail_session_internal_server_error(s);
286 } 286 }
287 287
288 return; 288 return;
313 ctx = ngx_mail_get_module_ctx(s, ngx_mail_auth_http_module); 313 ctx = ngx_mail_get_module_ctx(s, ngx_mail_auth_http_module);
314 314
315 if (rev->timedout) { 315 if (rev->timedout) {
316 ngx_log_error(NGX_LOG_ERR, rev->log, NGX_ETIMEDOUT, 316 ngx_log_error(NGX_LOG_ERR, rev->log, NGX_ETIMEDOUT,
317 "auth http server %V timed out", ctx->peer.name); 317 "auth http server %V timed out", ctx->peer.name);
318 ngx_close_connection(ctx->peer.connection); 318 ngx_close_connection(c);
319 ngx_destroy_pool(ctx->pool); 319 ngx_destroy_pool(ctx->pool);
320 ngx_mail_session_internal_server_error(s); 320 ngx_mail_session_internal_server_error(s);
321 return; 321 return;
322 } 322 }
323 323
324 if (ctx->response == NULL) { 324 if (ctx->response == NULL) {
325 ctx->response = ngx_create_temp_buf(ctx->pool, 1024); 325 ctx->response = ngx_create_temp_buf(ctx->pool, 1024);
326 if (ctx->response == NULL) { 326 if (ctx->response == NULL) {
327 ngx_close_connection(ctx->peer.connection); 327 ngx_close_connection(c);
328 ngx_destroy_pool(ctx->pool); 328 ngx_destroy_pool(ctx->pool);
329 ngx_mail_session_internal_server_error(s); 329 ngx_mail_session_internal_server_error(s);
330 return; 330 return;
331 } 331 }
332 } 332 }
344 344
345 if (n == NGX_AGAIN) { 345 if (n == NGX_AGAIN) {
346 return; 346 return;
347 } 347 }
348 348
349 ngx_close_connection(ctx->peer.connection); 349 ngx_close_connection(c);
350 ngx_destroy_pool(ctx->pool); 350 ngx_destroy_pool(ctx->pool);
351 ngx_mail_session_internal_server_error(s); 351 ngx_mail_session_internal_server_error(s);
352 } 352 }
353 353
354 354