diff --git a/rfoo/_rfoo.py b/rfoo/_rfoo.py index 1a15e75..fed7a46 100644 --- a/rfoo/_rfoo.py +++ b/rfoo/_rfoo.py @@ -75,6 +75,8 @@ try: except ImportError: import _thread as thread +from threading import Event + try: import __builtin__ as builtins except ImportError: @@ -444,7 +446,14 @@ class Server(object): self._handler_type = handler_type self._conn = conn self._ssl_context = ssl_context - + self._stop = Event() + + def stop(self): + self._stop.set() + + def stopped(self): + return self._stop.isSet() + def close(self): if self._conn is not None: try: @@ -464,6 +473,8 @@ class Server(object): self._conn.listen(5) while True: + if self.stopped(): + break conn, addr = self._conn.accept() conn.settimeout(None) if self._ssl_context != None: diff --git a/setup.py b/setup.py index 146ed4a..96b245a 100644 --- a/setup.py +++ b/setup.py @@ -74,7 +74,7 @@ ext_modules = [Extension("rfoo.marsh", ["rfoo/marsh.pyx"])] setup( name = 'rfoo', - version = '1.3.0-ssl-0', + version = '1.3.0-ssl-1', description = 'Fast RPC client/server module.', author = 'Nir Aides', author_email = 'nir@winpdb.org',