bumptech / stud

The Scalable TLS Unwrapping Daemon
Other
1.43k stars 193 forks source link

Properly handle data queued in the SSL layer #149

Open mendsley opened 9 years ago

mendsley commented 9 years ago

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.