On 10:13 am, albert.brandl@weiermayer.com wrote:
Hi!
On Fri, Nov 18, 2011 at 08:31:18AM -0500, Itamar Turner-Trauring wrote:
Presumably there is a method somewhere that decides to close the connection down:
def timeToShutdown(self): self.transport.loseConnection()
Actually, I hoped that I'd find such a method in the framework. When the twistd daemon is shut down, it has to close all connections, and it would have been nice if there were a hook that could be overridden.
But AFAICT, the respective code is buried inside the BaseConnector class, and I'd rather leave it alone :-).
Anyway - it should be possible to send some kind of message to the daemon in the init script before shutting it down.
The shutdown hook provided is IService.stopService. You can add your custom shutdown logic there, and attach your service to the Application/Service hierarchy. Jean-Paul