Asyncore processing thread synchronisation

- threre was a synchronisation problem where one thread could process
more data than another thread was expecting, leading to the thread
crashing
master
Peter Šurda 6 years ago
parent f6d5d93bf2
commit dcc181bf75
Signed by untrusted user: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

@ -43,9 +43,12 @@ class AdvancedDispatcher(asyncore.dispatcher):
def process(self):
if not self.connected:
return False
while len(self.read_buf) >= self.expectBytes:
loop = 0
while True:
try:
with nonBlocking(self.processingLock):
if len(self.read_buf) < self.expectBytes:
return False
if getattr(self, "state_" + str(self.state))() is False:
break
except AttributeError:

Loading…
Cancel
Save