updates to just leverage broker clients instead of repeating logic for now, until broker is refactored
This commit is contained in:
parent
0b770d8350
commit
994fe042e1
2 changed files with 2 additions and 8 deletions
|
@ -136,8 +136,6 @@ class CoreHandler(SocketServer.BaseRequestHandler):
|
|||
logging.info("connection closed: %s", self.client_address)
|
||||
if self.session:
|
||||
# remove client from session broker and shutdown if there are no clients
|
||||
clients = self.server.session_clients.setdefault(self.session.session_id, [])
|
||||
clients.remove(self)
|
||||
self.remove_session_handlers()
|
||||
self.session.broker.session_clients.remove(self)
|
||||
if not self.session.broker.session_clients and not self.session.is_active():
|
||||
|
@ -537,8 +535,6 @@ class CoreHandler(SocketServer.BaseRequestHandler):
|
|||
|
||||
# TODO: add shutdown handler for session
|
||||
self.session = self.coreemu.create_session(port, master=False)
|
||||
clients = self.server.session_clients.setdefault(self.session.session_id, [])
|
||||
clients.append(self)
|
||||
logging.debug("created new session for client: %s", self.session.session_id)
|
||||
|
||||
# TODO: hack to associate this handler with this sessions broker for broadcasting
|
||||
|
@ -1798,7 +1794,7 @@ class CoreUdpHandler(CoreHandler):
|
|||
Client has connected, set up a new connection.
|
||||
:return: nothing
|
||||
"""
|
||||
logging.info("new UDP connection: %s", self.client_address)
|
||||
pass
|
||||
|
||||
def receive_message(self):
|
||||
data = self.request[0]
|
||||
|
@ -1861,8 +1857,7 @@ class CoreUdpHandler(CoreHandler):
|
|||
if not isinstance(message, (coreapi.CoreNodeMessage, coreapi.CoreLinkMessage)):
|
||||
return
|
||||
|
||||
clients = self.server.mainserver.session_clients.setdefault(self.session.session_id, [])
|
||||
for client in clients:
|
||||
for client in self.session.broker.session_clients:
|
||||
try:
|
||||
client.sendall(message.raw_message)
|
||||
except IOError:
|
||||
|
|
|
@ -26,7 +26,6 @@ class CoreServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
|
|||
"""
|
||||
self.coreemu = CoreEmu(config)
|
||||
self.config = config
|
||||
self.session_clients = {}
|
||||
SocketServer.TCPServer.__init__(self, server_address, handler_class)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue