andyedinborough / aenetmail

C# POP/IMAP Mail Client
370 stars 153 forks source link

IMAP IDLE changes #155

Closed philipspigelmire closed 10 years ago

philipspigelmire commented 10 years ago

I was having trouble with this library using IMAP IDLE. I made some changes to prevent the connection timeout and to keep the IDLE working after receiving messages, but I still would get silent exceptions whenever the server connection would go down (through my testing).

I changed the library from threads to TPL tasks and added an exception event that a client app can subscribe to and decide what it wants to do (log and attempt to reconnect perhaps).

I also had issues with my service not shutting down cleanly and tracked this down to items in Disconnect() not working quite right - I may have caused these with my other code changes though.

First time putting something up on GitHub, so hope all is okay.

Thanks for the library!

andyedinborough commented 10 years ago

Very nice. I'll merge this in with a few style tweaks. Thanks!

On Mar 14, 2014, at 9:03 PM, philipspigelmire notifications@github.com wrote:

I was having trouble with this library using IMAP IDLE. I made some changes to prevent the connection timeout and to keep the IDLE working after receiving messages, but I still would get silent exceptions whenever the server connection would go down (through my testing).

I changed the library from threads to TPL tasks and added an exception event that a client app can subscribe to and decide what it wants to do (log and attempt to reconnect perhaps).

I also had issues with my service not shutting down cleanly and tracked this down to items in Disconnect() not working quite right - I may have caused these with my other code changes though.

First time putting something up on GitHub, so hope all is okay.

Thanks for the library!

You can merge this Pull Request by running

git pull https://github.com/philipspigelmire/aenetmail master Or view, comment on, or merge it at:

https://github.com/andyedinborough/aenetmail/pull/155

Commit Summary

Change IMAP IDLE to use TPL Tasks - no more abort and allows user to catch socket exceptions. Add an exception event so users can catch exceptions that happen in the tasks. Removed call to NOOP after IDLE timeout. Add server and idle timeout properties. Change Disconnect to close _Stream. Thread/Task/Resource cleanup in Disconnect File Changes

M AE.Net.Mail.csproj (6) M ImapClient.cs (225) A ImapClientException.cs (18) A ImapClientExceptionEventArgs.cs (17) M TextClient.cs (25) M Utilities.cs (4) Patch Links:

https://github.com/andyedinborough/aenetmail/pull/155.patch https://github.com/andyedinborough/aenetmail/pull/155.diff — Reply to this email directly or view it on GitHub.