@@ -187,6 +187,14 @@ class Connection(object):
|
||||
"""
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def handle_fork(self):
|
||||
"""
|
||||
Called after a forking. This should cleanup any remaining reactor state
|
||||
from the parent process.
|
||||
"""
|
||||
pass
|
||||
|
||||
def close(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
@@ -146,6 +146,12 @@ class AsyncoreConnection(Connection, asyncore.dispatcher):
|
||||
if not cls._loop:
|
||||
cls._loop = AsyncoreLoop()
|
||||
|
||||
@classmethod
|
||||
def handle_fork(cls):
|
||||
if cls._loop:
|
||||
cls._loop._cleanup()
|
||||
cls._loop = None
|
||||
|
||||
@classmethod
|
||||
def factory(cls, *args, **kwargs):
|
||||
timeout = kwargs.pop('timeout', 5.0)
|
||||
|
||||
@@ -227,6 +227,12 @@ class LibevConnection(Connection):
|
||||
if not cls._libevloop:
|
||||
cls._libevloop = LibevLoop()
|
||||
|
||||
@classmethod
|
||||
def handle_fork(cls):
|
||||
if cls._libevloop:
|
||||
cls._libevloop._cleanup()
|
||||
cls._libevloop = None
|
||||
|
||||
@classmethod
|
||||
def factory(cls, *args, **kwargs):
|
||||
timeout = kwargs.pop('timeout', 5.0)
|
||||
|
||||
Reference in New Issue
Block a user