mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-09 04:19:10 -04:00
be_openssl: don't call set_open_callbacks() if fd == -1
This must be illegal, firstly we must do set_do handshake and only after this we could read/write.
This commit is contained in:
parent
2a8a7112a5
commit
e8a2da96e3
@ -980,10 +980,9 @@ set_open_callbacks(struct bufferevent_openssl *bev_ssl, evutil_socket_t fd)
|
||||
int rpending=0, wpending=0, r1=0, r2=0;
|
||||
|
||||
if (event_initialized(&bev->ev_read)) {
|
||||
if (fd >= 0) {
|
||||
rpending = event_pending(&bev->ev_read, EV_READ, NULL);
|
||||
wpending = event_pending(&bev->ev_write, EV_WRITE, NULL);
|
||||
}
|
||||
rpending = event_pending(&bev->ev_read, EV_READ, NULL);
|
||||
wpending = event_pending(&bev->ev_write, EV_WRITE, NULL);
|
||||
|
||||
event_del(&bev->ev_read);
|
||||
event_del(&bev->ev_write);
|
||||
}
|
||||
@ -1297,7 +1296,7 @@ be_openssl_ctrl(struct bufferevent *bev,
|
||||
bio = BIO_new_socket(data->fd, 0);
|
||||
SSL_set_bio(bev_ssl->ssl, bio, bio);
|
||||
}
|
||||
if (bev_ssl->state == BUFFEREVENT_SSL_OPEN)
|
||||
if (bev_ssl->state == BUFFEREVENT_SSL_OPEN && data->fd >= 0)
|
||||
return set_open_callbacks(bev_ssl, data->fd);
|
||||
else {
|
||||
return set_handshake_callbacks(bev_ssl, data->fd);
|
||||
|
Loading…
x
Reference in New Issue
Block a user