bertjohnson/OpaqueMail

Pop3Client.LogOut() leaves client in borked state

Closed this issue · 2 comments

If I explicitly call LogOut() on a Pop3Client, at least some mail servers will close the connection. (I'm currently testing with hMailServer.) Then when the client gets disposed, LogOut() gets called again, and the following ReadData() throws an IOException.

I'm not sure what the best fix is – maybe LogOut() should clean up after itself better so that Dispose() knows that the client is already disconnected?

The Pop3Client probably just needs to have LogOut() set a boolean 'connected' variable to false or dispose the stream and then the Dispose() method would just need to check for that case and not try to disconnect an already-disconnected socket.

Thanks for the report asherber. Release 2.1.2 now ignores it when POP3 servers end the connection prior to sending a "goodbye" message.