[nginx] Mail: fixed ngx_mail_send() (ticket #519).

Maxim Dounin mdounin at mdounin.ru
Mon Mar 31 17:40:00 UTC 2014


details:   http://hg.nginx.org/nginx/rev/b42e7c790b81
branches:  
changeset: 5632:b42e7c790b81
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Mon Mar 31 21:38:27 2014 +0400
description:
Mail: fixed ngx_mail_send() (ticket #519).

diffstat:

 src/mail/ngx_mail_handler.c |  7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diffs (26 lines):

diff --git a/src/mail/ngx_mail_handler.c b/src/mail/ngx_mail_handler.c
--- a/src/mail/ngx_mail_handler.c
+++ b/src/mail/ngx_mail_handler.c
@@ -559,8 +559,13 @@ ngx_mail_send(ngx_event_t *wev)
     n = c->send(c, s->out.data, s->out.len);
 
     if (n > 0) {
+        s->out.data += n;
         s->out.len -= n;
 
+        if (s->out.len != 0) {
+            goto again;
+        }
+
         if (wev->timer_set) {
             ngx_del_timer(wev);
         }
@@ -584,6 +589,8 @@ ngx_mail_send(ngx_event_t *wev)
 
     /* n == NGX_AGAIN */
 
+again:
+
     cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
 
     ngx_add_timer(c->write, cscf->timeout);



More information about the nginx-devel mailing list