If, after an SSL_read operation, there is still data pending in
the SSL layer (such as the remainder of a TLS record), we need
to simulate an EV_READ event on the watcher. OpenSSL won't attempt
to read the data from the underlying socket until this data is
consumed. Since there is no new activity on the socket, libev will
not trigger a new EV_READ notification.
This just happened to work with the large () buffers passed to
SSL_read from the ringbuffer. However, when adjusting these buffers,
it becomes increasingly likely to deadlock a socket by leaving
this pending data in the OpenSSL buffers.
If, after an SSL_read operation, there is still data pending in the SSL layer (such as the remainder of a TLS record), we need to simulate an EV_READ event on the watcher. OpenSSL won't attempt to read the data from the underlying socket until this data is consumed. Since there is no new activity on the socket, libev will not trigger a new EV_READ notification.
This just happened to work with the large () buffers passed to SSL_read from the ringbuffer. However, when adjusting these buffers, it becomes increasingly likely to deadlock a socket by leaving this pending data in the OpenSSL buffers.