Release locks properly
This commit is contained in:
parent
eab8bee828
commit
8c3fc6842d
|
@ -103,6 +103,7 @@ class token:
|
||||||
|
|
||||||
:param bytes_: (packet) bytes to enqueue
|
:param bytes_: (packet) bytes to enqueue
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
# Acquire the buffer lock
|
# Acquire the buffer lock
|
||||||
self.bufferLock.acquire()
|
self.bufferLock.acquire()
|
||||||
|
|
||||||
|
@ -115,14 +116,16 @@ class token:
|
||||||
self.queue += bytes_
|
self.queue += bytes_
|
||||||
else:
|
else:
|
||||||
log.warning("{}'s packets buffer is above 10M!! Lost some data!".format(self.username))
|
log.warning("{}'s packets buffer is above 10M!! Lost some data!".format(self.username))
|
||||||
|
finally:
|
||||||
# Release the buffer lock
|
# Release the buffer lock
|
||||||
self.bufferLock.release()
|
self.bufferLock.release()
|
||||||
|
|
||||||
def resetQueue(self):
|
def resetQueue(self):
|
||||||
"""Resets the queue. Call when enqueued packets have been sent"""
|
"""Resets the queue. Call when enqueued packets have been sent"""
|
||||||
|
try:
|
||||||
self.bufferLock.acquire()
|
self.bufferLock.acquire()
|
||||||
self.queue = bytes()
|
self.queue = bytes()
|
||||||
|
finally:
|
||||||
self.bufferLock.release()
|
self.bufferLock.release()
|
||||||
|
|
||||||
def joinChannel(self, channelObject):
|
def joinChannel(self, channelObject):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user