Question: killing/shuting down asyncore servers

Jim Fulton jim@d...
Tue, 26 Sep 2000 09:21:45 -0400


Are there any recommendations for shutting down
asyncore-based servers cleanly from outside the
servers?

- Can a clean signal handler be written to
handle kill events? I tried writing a signal
handler that closed all the entries in the socket
map, but I have a feeling that this isn't working
properly. One of the problems I want to solve is
getting the socket I'm listening on to close
cleanly so that it isn't in use when I restart
the server.

I suspect I could make this work with some sort of
dedicated select trigger. I think it probably wants
to be dedicated because, if I used an existing select
trigger, I'd need to worry about the possability that
the signal would interrupt I/O on the select trigger.

- I suppose I could include a shutdown server, such that
if connections were made to this server, the application 
would shut-down cleanly. I could obviously generalize this
to a more general control server, which might provide
other commands. This approach is more portable, but
requires clients more complicated than kill. :)

How are other folks solving this problem?

Jim

--
Jim Fulton mailto:jim@d...
Technical Director (888) 344-4332 Python Powered!
Digital Creations http://www.digicool.com http://www.python.org

Under US Code Title 47, Sec.227(b)(1)(C), Sec.227(a)(2)(B) This email
address may not be added to any commercial mail list with out my
permission. Violation of my privacy with advertising or SPAM will
result in a suit for a MINIMUM of $500 damages/incident, $1500 for
repeats.