Open link2xt opened 1 year ago
From RFC 2920:
Client SMTP implementations MAY elect to operate in a nonblocking fashion, processing server responses immediately upon receipt, even if there is still data pending transmission from the client's previous TCP send operation. If nonblocking operation is not supported, however, client SMTP implementations MUST also check the TCP window size and make sure that each group of commands fits entirely within the window. The window size is usually, but not always, 4K octets. Failure to perform this check can lead to deadlock conditions.
Spawning a task to write requests, while reading responses in the main task, may work, but splitting generic stream into read and write part is complicated. It's not easy to do even for TcpStream in tokio currently: https://github.com/tokio-rs/tokio-core/issues/198
I know it should be as easy as copying the file descriptor of the underlying TCP socket, but async TcpStream is currently not cloneable, unlike std::io
one.
See comment at https://github.com/async-email/async-smtp/pull/57/files#r1090076853