emailjs / emailjs-imap-client

Low-level JS IMAP client for all your IMAP needs.
MIT License
552 stars 123 forks source link

Socket closing is not an error. #266

Closed ltgorm closed 11 months ago

ltgorm commented 11 months ago

Socket will close when network goes down e.g. when machine is being suspended/hibernated. This should not be treated as an error. Rather, the imap-client should wrap up and close also.

nifgraup commented 11 months ago

Erroring on socket close gives an opportunity to reconnect to start idling again. Especialy when the reason isn't network down and there is no outside online/offline event to trigger reconnect.

ltgorm commented 11 months ago

That is a good point. It is the teardown in the close method that I was after. Because otherwise we have a looming socketTimeoutTimer when the system wakes up again. I have commited a change where we do both: close and report error. Additionally, to reduce the noise in the logs, is to not log if the client has been supplied with an onerror function from its user.

nifgraup commented 11 months ago

looks good, squashed and pushed as 0309d294f599efa7c5f4e47564f39046ab09623a