.BANCHO. .FIX. Fix streams and temporary chat channels not being disposed correctly

This commit is contained in:
Nyo 2016-12-21 18:17:29 +01:00
parent 2ae3c5f701
commit 8a8a4968a3
4 changed files with 22 additions and 2 deletions

View File

@ -2,6 +2,7 @@ from common.log import logUtils as log
from constants import serverPackets
from objects import channel
from objects import glob
from helpers import chatHelper as chat
class channelList:
@ -63,7 +64,12 @@ class channelList:
if name not in self.channels:
log.debug("{} is not in channels list".format(name))
return
glob.streams.broadcast("chat/{}".format(name), serverPackets.channelKicked(name))
#glob.streams.broadcast("chat/{}".format(name), serverPackets.channelKicked(name))
stream = glob.streams.getStream("chat/{}".format(name))
if stream is not None:
for token in stream.clients:
if token in glob.tokens.tokens:
chat.partChannel(channel=name, token=glob.tokens.tokens[token], kick=True)
glob.streams.dispose("chat/{}".format(name))
glob.streams.remove("chat/{}".format(name))
self.channels.pop(name)

View File

@ -355,6 +355,7 @@ class match:
glob.streams.broadcast(self.streamName, serverPackets.matchComplete())
# Destroy playing stream
glob.streams.dispose(self.playingStreamName)
glob.streams.remove(self.playingStreamName)
# Console output

View File

@ -41,6 +41,8 @@ class matchList:
# Remove match object and stream
match = self.matches.pop(matchID)
glob.streams.dispose(match.streamName)
glob.streams.dispose(match.playingStreamName)
glob.streams.remove(match.streamName)
glob.streams.remove(match.playingStreamName)

View File

@ -80,4 +80,15 @@ class streamList:
"""
if streamName not in self.streams:
return
self.streams[streamName].dispose(*args, **kwargs)
self.streams[streamName].dispose(*args, **kwargs)
def getStream(self, streamName):
"""
Returns streamName's stream object or None if it doesn't exist
:param streamName:
:return:
"""
if streamName in self.streams:
return self.streams[streamName]
return None