Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Properly handle data queued in the SSL layer #149

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mendsley
Copy link

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.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant