socket: Close old connections before registering new ones under the same id

(imported from commit f9b75288cbf7e2d9baa3254d57443eea5c1f3fc3)
This commit is contained in:
Zev Benjamin 2013-12-09 13:57:31 -05:00
parent 6443a3ed78
commit 0d989a6972
1 changed files with 4 additions and 0 deletions

View File

@ -47,6 +47,10 @@ def get_connection(id):
return connections.get(id)
def register_connection(id, conn):
# Kill any old connections if they exist
if id in connections:
connections[id].close()
conn.client_id = id
connections[conn.client_id] = conn