Is This Way OK?

John Abel john.abel at pa.press.net
Sun Mar 30 15:04:52 EST 2003


Hi,

I've been playing around with Medusa, and wanted to run a small FTP server
as a service.  Can someone have a look at this code, and see any problems I
may have with it?  It works OK, but examples of Medusa as a Win32 service
are few, and far between.  This is the main function from my service:

    def SvcDoRun( self ):
        logFile = logger.file_logger(
"D:\\Scripts\\LogFiles\\FTP-Xfer.log" )
        ftpServ = ftp_server.ftp_server( Win32Authorizer(),
                                            port=21,
                                            logger_object=logFile )
        timeout=5
        map = asyncore.socket_map

        while map:
            retCode = win32event.WaitForSingleObject( self.hWaitStop, 500 )
            if retCode == win32event.WAIT_OBJECT_0:
                break
            asyncore.poll(timeout, map)

It works OK, I can stop and start the service without any problems.
However, am I likely to run into any problems by using this cutdown, and
modified version of asyncore.loop?

Thanks

John






More information about the Python-list mailing list