mirror of
https://github.com/nginx/nginx.git
synced 2026-10-09 02:02:22 +00:00
move event handling to protocol specific code,
it is required to support SMTP greeting delay
This commit is contained in:
parent
5fbe12146e
commit
706ab65f54
4 changed files with 21 additions and 9 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue