Commit 4e62cd167b66f33e20344bff776253f19e2bc3e6

Mark Ellzey 2012-03-30T15:08:40

Fixed potential double-readcb execution with openssl bufferevents. the function do_read() will call SSL_read(), and if successful, will call _bufferevent_run_readcb() before returning to consider_reading(). consider_reading() will then check SSL_pending() to make sure all pending data has also been read. If it does not, do_read() is called again. The issue with this is the possibility that the function that is executed by _bufferevent_run_readcb() called bufferevent_disable(ssl_bev, EV_READ) before the second do_read(); In this case, the users read callback is executed a second time. This is potentially bad for applications that expect the bufferevent to stay disabled until further notice. (this is why running openssl bufferevents without DEFER_CALLBACKS has always been troublesome).