server: fix some bugs lol

This commit is contained in:
Marks Polakovs 2020-04-07 11:45:00 +02:00
parent 9daa1e6d1b
commit d3a44d5f0a

View file

@ -109,10 +109,12 @@ class Session(object):
print(self.connection_id, "going away") print(self.connection_id, "going away")
if self.sender is not None: if self.sender is not None:
self.sender.end() self.sender.end()
await self.pc.close() if self.pc is not None:
await self.pc.close()
init_buffers() init_buffers()
write_ob_status(False) write_ob_status(False)
await self.websocket.send(json.dumps({"kind": "REPLACED"})) if self.websocket is not None:
await self.websocket.send(json.dumps({"kind": "REPLACED"}))
def create_peerconnection(self): def create_peerconnection(self):
self.pc = RTCPeerConnection() self.pc = RTCPeerConnection()
@ -166,7 +168,7 @@ class Session(object):
answer = await self.pc.createAnswer() answer = await self.pc.createAnswer()
await self.pc.setLocalDescription(answer) await self.pc.setLocalDescription(answer)
await websocket.send( await self.websocket.send(
json.dumps( json.dumps(
{ {
"kind": "ANSWER", "kind": "ANSWER",