SSL: fixed ngx_ssl_handshake() with level-triggered event methods.

Missing calls to ngx_handle_write_event() and ngx_handle_read_event()
resulted in a CPU hog during SSL handshake if an level-triggered event
method (e.g. select) was used.
This commit is contained in:
Maxim Dounin 2013-02-01 14:37:43 +00:00
parent 5ef334fff4
commit fabab386ed

View file

@ -808,6 +808,10 @@ ngx_ssl_handshake(ngx_connection_t *c)
return NGX_ERROR;
}
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
return NGX_ERROR;
}
return NGX_AGAIN;
}
@ -816,6 +820,10 @@ ngx_ssl_handshake(ngx_connection_t *c)
c->read->handler = ngx_ssl_handshake_handler;
c->write->handler = ngx_ssl_handshake_handler;
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
return NGX_ERROR;
}
if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
return NGX_ERROR;
}