medusa as win32 service
From: Robin Becker (robin_at_jessikat.fsnet.co.uk)
Date: 11/30/03
- Next message: Fredrik Lundh: "Re: pil bug?"
- Previous message: Kristian Ovaska: "Re: custom sorting and __cmp__"
- Next in thread: Pekka Niiranen: "HELP: W2K Python + Cygwin shell script"
- Reply: Pekka Niiranen: "HELP: W2K Python + Cygwin shell script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 30 Nov 2003 18:03:19 +0000
I wonder if this is the right way to write a medusa(asyncore) server
with the win32all framework. Other example services seem to create an
event to pass the stop signal from SvcStop into a separate termination
method, but I'm unsure how that would mix with the polling loop.
This simple framework seems to start and stop OK, but I wonder if I'm
missing some obvious race or something.
import win32serviceutil, win32service,
class MeducaService(win32serviceutil.ServiceFramework):
_svc_name_ = "MedusaService"
_svc_display_name_ = "Medusa Service"
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
print "Received Quit from Win32"
socket_map = asyncore.socket_map
while socket_map:
k, v = socket_map.popitem()
try:
print "Shutting down",k,v
v.close()
except:
pass
del k, v
def SvcDoRun(self):
start_medusa()
-- Robin Becker
- Next message: Fredrik Lundh: "Re: pil bug?"
- Previous message: Kristian Ovaska: "Re: custom sorting and __cmp__"
- Next in thread: Pekka Niiranen: "HELP: W2K Python + Cygwin shell script"
- Reply: Pekka Niiranen: "HELP: W2K Python + Cygwin shell script"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|