imapsrv icon indicating copy to clipboard operation
imapsrv copied to clipboard

Need a server.stop()

Open twitchyliquid64 opened this issue 11 years ago • 5 comments

We need to have a method which:

  • Closes all listeners
  • terminates all client connections
  • shuts down all goroutines
  • returns control to the caller.

twitchyliquid64 avatar Nov 04 '14 11:11 twitchyliquid64

I think the right way to do this is to see the server as a service this allow the user to setup the configuration, start the it then wait for signals to gracefully shutdown the service.

I've already used this patern in a daemon I've been coding at work and it does the job.

Here is the article where I've found the patern, the explaination is great http://rcrowley.org/articles/golang-graceful-stop.html

g-dormoy avatar Nov 04 '14 12:11 g-dormoy

If you agree on that I'll take care of this.

g-dormoy avatar Nov 05 '14 12:11 g-dormoy

Yepp :) On Nov 5, 2014 11:53 PM, "Guillaume" [email protected] wrote:

If you agree on that I'll take care of this.

— Reply to this email directly or view it on GitHub https://github.com/alienscience/imapsrv/issues/8#issuecomment-61802450.

twitchyliquid64 avatar Nov 05 '14 14:11 twitchyliquid64

Short update

I'm struggling with the reader, indeed actually the when a client connected to the server it's blocked while waiting for bytes to be read. I need to find the best way to fix this, I think we should close all the connection with the client at server stop.

I hope I'll be done by the end of the week.

g-dormoy avatar Nov 18 '14 09:11 g-dormoy

Hi guys I'm getting off this ticket, my laptop broke last month and my productivity got ruined with it (I can't get to code on my desktop...)

I'll be back when I can but if anyone wants to make change on this feel free

g-dormoy avatar Dec 23 '14 16:12 g-dormoy