Added logic to close routes
Not called on close() yet because of server/client inconsistencies
This commit is contained in:
parent
c43ed25410
commit
4eae2567ad
1 changed files with 12 additions and 4 deletions
|
@ -60,6 +60,9 @@ class Route:
|
|||
def start(self, handler):
|
||||
pass
|
||||
|
||||
def stop(self, handler):
|
||||
pass
|
||||
|
||||
|
||||
class Pipe(Route):
|
||||
def run(self, data, peer, handler):
|
||||
|
@ -82,6 +85,14 @@ def launch_routes(created_routes, handler):
|
|||
pass
|
||||
|
||||
|
||||
def close_routes(created_routes, handler):
|
||||
for prefix in created_routes:
|
||||
try:
|
||||
created_routes[prefix].stop(handler)
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
|
||||
def create_exchange_map(routes):
|
||||
exchange_map = {0 : META_ROUTE}
|
||||
exchange_id = 1
|
||||
|
@ -160,9 +171,6 @@ class DummyPipe(Route):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Message packing and unpacking
|
||||
def create_metadata(data_type, converted_route, indexed_dict=False):
|
||||
return struct.pack(PACK_FORMAT,
|
||||
|
@ -390,4 +398,4 @@ class Client(WebSocketClient, Shared):
|
|||
self.peer_reverse_exchange_routes[route], id_, debug=self.debug),
|
||||
PIPE_ROUTE)
|
||||
except KeyError:
|
||||
Logging.warning("'%s' does not exist." % route)
|
||||
Logging.warning("'%s' does not exist." % route)
|
||||
|
|
Reference in a new issue