mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
move event handling to protocol specific code,
it is required to support SMTP greeting delay
This commit is contained in:
@@ -253,12 +253,6 @@ ngx_mail_init_session(ngx_connection_t *c)
|
||||
return;
|
||||
}
|
||||
|
||||
ngx_add_timer(c->read, cscf->timeout);
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
ngx_mail_close_connection(c);
|
||||
}
|
||||
|
||||
c->write->handler = ngx_mail_send;
|
||||
|
||||
ngx_mail_init_sessions[s->protocol](s, c);
|
||||
|
||||
@@ -45,11 +45,17 @@ ngx_mail_imap_init_session(ngx_mail_session_t *s, ngx_connection_t *c)
|
||||
}
|
||||
}
|
||||
|
||||
c->read->handler = ngx_mail_imap_init_protocol;
|
||||
|
||||
s->out.len = sizeof(imap_greeting) - 1;
|
||||
s->out.data = imap_greeting;
|
||||
|
||||
c->read->handler = ngx_mail_imap_init_protocol;
|
||||
|
||||
ngx_add_timer(c->read, cscf->timeout);
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
ngx_mail_close_connection(c);
|
||||
}
|
||||
|
||||
ngx_mail_send(c->write);
|
||||
}
|
||||
|
||||
|
||||
@@ -62,6 +62,12 @@ ngx_mail_pop3_init_session(ngx_mail_session_t *s, ngx_connection_t *c)
|
||||
|
||||
c->read->handler = ngx_mail_pop3_init_protocol;
|
||||
|
||||
ngx_add_timer(c->read, cscf->timeout);
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
ngx_mail_close_connection(c);
|
||||
}
|
||||
|
||||
ngx_mail_send(c->write);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,9 +41,15 @@ ngx_mail_smtp_init_session(ngx_mail_session_t *s, ngx_connection_t *c)
|
||||
}
|
||||
}
|
||||
|
||||
s->out = cscf->smtp_greeting;
|
||||
|
||||
c->read->handler = ngx_mail_smtp_init_protocol;
|
||||
|
||||
s->out = cscf->smtp_greeting;
|
||||
ngx_add_timer(c->read, cscf->timeout);
|
||||
|
||||
if (ngx_handle_read_event(c->read, 0) == NGX_ERROR) {
|
||||
ngx_mail_close_connection(c);
|
||||
}
|
||||
|
||||
ngx_mail_send(c->write);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user