Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read responses in parallel with writing request when pipelining #58

Open
link2xt opened this issue Jan 31, 2023 · 2 comments
Open

Read responses in parallel with writing request when pipelining #58

link2xt opened this issue Jan 31, 2023 · 2 comments

Comments

@link2xt
Copy link
Collaborator

link2xt commented Jan 31, 2023

See comment at https://github.com/async-email/async-smtp/pull/57/files#r1090076853

@link2xt
Copy link
Collaborator Author

link2xt commented Feb 1, 2023

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.

@link2xt
Copy link
Collaborator Author

link2xt commented Feb 1, 2023

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: tokio-rs/tokio-core#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant