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

fix read and write I/O timeout. #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

ly020044
Copy link

If the connected pop3 server port is not open, the timeout option will not take effect.

@knadh
Copy link
Owner

knadh commented May 19, 2022

Thanks for the PR. This should ideally be new params called opt.ReadTimeout and opt.WriteTimeout. In addition, the timeouts should be reset on encountering ErrDeadlineExceeded.

@ly020044
Copy link
Author

By reset do you mean when the io.Reader or io.Writer encounters os.ErrDeadlineExceeded? I don't understand, thanks!

@knadh
Copy link
Owner

knadh commented May 20, 2022

After a deadline has been exceeded, the connection can be refreshed by setting a deadline in the future.

It is explained in the comments here: https://pkg.go.dev/net#Conn

Basically, if a connection times out, if it has to be reused, its deadlines have to be set again.

@ly020044
Copy link
Author

ly020044 commented May 20, 2022

Thanks for reply!

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

Successfully merging this pull request may close these issues.

None yet

2 participants