.BANCHO. .FIX. Fix streams and temporary chat channels not being disposed correctly
This commit is contained in:
parent
2ae3c5f701
commit
8a8a4968a3
|
@ -2,6 +2,7 @@ from common.log import logUtils as log
|
||||||
from constants import serverPackets
|
from constants import serverPackets
|
||||||
from objects import channel
|
from objects import channel
|
||||||
from objects import glob
|
from objects import glob
|
||||||
|
from helpers import chatHelper as chat
|
||||||
|
|
||||||
|
|
||||||
class channelList:
|
class channelList:
|
||||||
|
@ -63,7 +64,12 @@ class channelList:
|
||||||
if name not in self.channels:
|
if name not in self.channels:
|
||||||
log.debug("{} is not in channels list".format(name))
|
log.debug("{} is not in channels list".format(name))
|
||||||
return
|
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.dispose("chat/{}".format(name))
|
||||||
glob.streams.remove("chat/{}".format(name))
|
glob.streams.remove("chat/{}".format(name))
|
||||||
self.channels.pop(name)
|
self.channels.pop(name)
|
||||||
|
|
|
@ -355,6 +355,7 @@ class match:
|
||||||
glob.streams.broadcast(self.streamName, serverPackets.matchComplete())
|
glob.streams.broadcast(self.streamName, serverPackets.matchComplete())
|
||||||
|
|
||||||
# Destroy playing stream
|
# Destroy playing stream
|
||||||
|
glob.streams.dispose(self.playingStreamName)
|
||||||
glob.streams.remove(self.playingStreamName)
|
glob.streams.remove(self.playingStreamName)
|
||||||
|
|
||||||
# Console output
|
# Console output
|
||||||
|
|
|
@ -41,6 +41,8 @@ class matchList:
|
||||||
|
|
||||||
# Remove match object and stream
|
# Remove match object and stream
|
||||||
match = self.matches.pop(matchID)
|
match = self.matches.pop(matchID)
|
||||||
|
glob.streams.dispose(match.streamName)
|
||||||
|
glob.streams.dispose(match.playingStreamName)
|
||||||
glob.streams.remove(match.streamName)
|
glob.streams.remove(match.streamName)
|
||||||
glob.streams.remove(match.playingStreamName)
|
glob.streams.remove(match.playingStreamName)
|
||||||
|
|
||||||
|
|
|
@ -80,4 +80,15 @@ class streamList:
|
||||||
"""
|
"""
|
||||||
if streamName not in self.streams:
|
if streamName not in self.streams:
|
||||||
return
|
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
|
Loading…
Reference in New Issue
Block a user