Commit 21fd3631 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Added thread mutex to client.send_frame() because Server and Client may call it simultaneously

parent 7b56e728
import socket import socket
import logging import logging
from traceback import format_exc from traceback import format_exc
from threading import Thread from threading import Thread, Lock
from websocket import WebSocket from websocket import WebSocket
from exceptions import InvalidRequest from exceptions import InvalidRequest
...@@ -85,6 +85,11 @@ class Client(WebSocket): ...@@ -85,6 +85,11 @@ class Client(WebSocket):
self.address = address self.address = address
self.send_lock = Lock() self.send_lock = Lock()
def send_frame(self, frame):
self.send_lock.acquire()
WebSocket.send_frame(self, frame)
self.send_lock.release()
def onopen(self): def onopen(self):
self.server.onopen(self) self.server.onopen(self)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment