Open erikjohnston opened 8 years ago
The actual symptoms here are
WARN:pto::bridge: Could not handle matrix event: Error { repr: Os { code: 11, message: "Resource temporarily unavailable" } }
thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: Error { repr: Custom(Custom { kind: Other, error: Ssl([OpenSslError { library: "SSL routines", function: "SSL3_WRITE_PENDING", reason: "bad write retry" }]) }) }', ../src/libcore/result.rs:688
...in the middle of streaming lots of initial sync data through to the IRC client over SSL. I probably never noticed this before because I was either talking SSL over localhost from my irc client to my PTO, or just not speaking SSL at all given localhost stuff is no longer SSL'd.
Currently PTO uses the
Read + Write
traits ofSslStream
with MIO, however OpenSSL may return error conditions that require special handling when used with non-blocking sockets. These are not exposed via theRead + Write
traits (due to them returningio::Result
), which eventually causes PTO to panic.To use OpenSSL with non-blocking sockets correctly, PTO should use
SslStream::{ssl_read, ssl_write}
and handle thessl::Error::{WantRead, WantWrite}
conditions correctly.An alternative may be to use the Telos library instead of rust-openssl.