Both AsyncRead and AsyncWrite except the same contract as poll. Aka, reading and writing should be possible to perform on separate tasks. tokio-io assumes this w/ split. However, TLS may perform writes in reads and reads in writes. If TLS's read and writes are performed in separate tasks, it is possible to break the contract and end up with dead locks.
As far as I can tell, there is only a single possible fix and that is notifying both the reader task AND the writer task when either the inner read or write half becomes ready. Doing so would probably require using with_notify to implement a "broadcast" notification strategy where both the outer read & write tasks get notified when either the inner read or write become ready.
There could be potential refinements in the heuristic, but the general strategy would be the same.
Both
AsyncRead
andAsyncWrite
except the same contract aspoll
. Aka, reading and writing should be possible to perform on separate tasks. tokio-io assumes this w/split
. However, TLS may perform writes in reads and reads in writes. If TLS's read and writes are performed in separate tasks, it is possible to break the contract and end up with dead locks.As far as I can tell, there is only a single possible fix and that is notifying both the reader task AND the writer task when either the inner read or write half becomes ready. Doing so would probably require using
with_notify
to implement a "broadcast" notification strategy where both the outer read & write tasks get notified when either the inner read or write become ready.There could be potential refinements in the heuristic, but the general strategy would be the same.