Steven Davidovitz
2008-Feb-05 15:22 UTC
[Eventmachine-talk] Writing out to clients before Exit
Hi, I was wondering if it was possible to do something sort of like close_connection_after_writing for clients but with EventMachine.stop. Basically, I am trapping interrupts and trying to send out one last shutdown message before stopping EventMachine and I was wondering if there was a way to do it without implementing something new. This is using UDP/Datagram. Thanks. -- Steven Davidovitz <steviedizzle at gmail.com>
Marc-André Cournoyer
2008-Feb-05 18:46 UTC
[Eventmachine-talk] Writing out to clients before Exit
hey Steven, I had the same question a couple days ago: http://groups.google.com/group/eventmachine/browse_thread/thread/d29fb4829d3a2c5f/0235067f0f425479#0235067f0f425479 I followed one of Francis solution and stored all connections into an array and remove them in the Connection#unbind method. Then call EM.stop_server and wait for the connections array to empty when stopping. You can see the final result in Thin::Server#stop : http://github.com/macournoyer/thin/tree/master/lib/thin/server.rb#L82 Hope this helps! Marc On 5-Feb-08, at 6:22 PM, Steven Davidovitz wrote:> Hi, > > I was wondering if it was possible to do something sort of like > close_connection_after_writing for clients but with EventMachine.stop. > Basically, I am trapping interrupts and trying to send out one last > shutdown message before stopping EventMachine and I was wondering if > there was a way to do it without implementing something new. This is > using UDP/Datagram. > > Thanks. > -- > Steven Davidovitz <steviedizzle at gmail.com> > _______________________________________________ > Eventmachine-talk mailing list > Eventmachine-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/eventmachine-talk
Steven Davidovitz
2008-Feb-06 11:13 UTC
[Eventmachine-talk] Writing out to clients before Exit
Hey, Thanks alot, this was exactly what I was looking for. Guess I should have checked the archives first! Thanks again, Steven On Feb 5, 9:46?pm, Marc-Andr? Cournoyer <macourno... at gmail.com> wrote:> hey Steven, > > I had the same question a couple days ago:http://groups.google.com/group/eventmachine/browse_thread/thread/d29f... > > I followed one of Francis solution and stored all connections into an ? > array and remove them in the Connection#unbind method. Then call ? > EM.stop_server and wait for the connections array to empty when ? > stopping. > > You can see the final result in Thin::Server#stop :http://github.com/macournoyer/thin/tree/master/lib/thin/server.rb#L82 > > Hope this helps! > Marc > > On 5-Feb-08, at 6:22 PM, Steven Davidovitz wrote: > > > > > Hi, > > > I was wondering if it was possible to do something sort of like > > close_connection_after_writing for clients but with EventMachine.stop. > > Basically, I am trapping interrupts and trying to send out one last > > shutdown message before stopping EventMachine and I was wondering if > > there was a way to do it without implementing something new. This is > > using UDP/Datagram. > > > Thanks. > > -- > > Steven Davidovitz <steviediz... at gmail.com> > > _______________________________________________ > > Eventmachine-talk mailing list > > Eventmachine-t... at rubyforge.org > >http://rubyforge.org/mailman/listinfo/eventmachine-talk > > _______________________________________________ > Eventmachine-talk mailing list > Eventmachine-t... at rubyforge.orghttp://rubyforge.org/mailman/listinfo/eventmachine-talk
Francis Cianfrocca
2008-Feb-06 13:01 UTC
[Eventmachine-talk] Writing out to clients before Exit
On Feb 5, 2008 9:46 PM, Marc-Andr? Cournoyer <macournoyer at gmail.com> wrote:> hey Steven, > > I had the same question a couple days ago: > http://groups.google.com/group/eventmachine/browse_thread/thread/d29fb4829d3a2c5f/0235067f0f425479#0235067f0f425479 > > I followed one of Francis solution and stored all connections into an > array and remove them in the Connection#unbind method. Then call > EM.stop_server and wait for the connections array to empty when > stopping. > > You can see the final result in Thin::Server#stop : > http://github.com/macournoyer/thin/tree/master/lib/thin/server.rb#L82 > >Marc-Andre, there is a new EventMachine Wiki at rubyeventmachine.com. It would be great if you could add a page to it, and describe your solution. That way other people could benefit from it. Thanks! -francis -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20080206/2dbadfb4/attachment-0001.html
Marc-André Cournoyer
2008-Feb-06 13:38 UTC
[Eventmachine-talk] Writing out to clients before Exit
added there => http://rubyeventmachine.com/wiki/CodeSnippets On 6-Feb-08, at 4:01 PM, Francis Cianfrocca wrote:> On Feb 5, 2008 9:46 PM, Marc-Andr? Cournoyer <macournoyer at gmail.com> > wrote: > hey Steven, > > I had the same question a couple days ago: http://groups.google.com/group/eventmachine/browse_thread/thread/d29fb4829d3a2c5f/0235067f0f425479#0235067f0f425479 > > I followed one of Francis solution and stored all connections into an > array and remove them in the Connection#unbind method. Then call > EM.stop_server and wait for the connections array to empty when > stopping. > > You can see the final result in Thin::Server#stop : http://github.com/macournoyer/thin/tree/master/lib/thin/server.rb#L82 > > > > Marc-Andre, there is a new EventMachine Wiki at > rubyeventmachine.com. It would be great if you could add a page to > it, and describe your solution. That way other people could benefit > from it. Thanks! > -francis > _______________________________________________ > Eventmachine-talk mailing list > Eventmachine-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/eventmachine-talk-------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/eventmachine-talk/attachments/20080206/87d5986c/attachment.html