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
This commit is contained in:
parent
f6d5d93bf2
commit
dcc181bf75
|
@ -43,9 +43,12 @@ class AdvancedDispatcher(asyncore.dispatcher):
|
||||||
def process(self):
|
def process(self):
|
||||||
if not self.connected:
|
if not self.connected:
|
||||||
return False
|
return False
|
||||||
while len(self.read_buf) >= self.expectBytes:
|
loop = 0
|
||||||
|
while True:
|
||||||
try:
|
try:
|
||||||
with nonBlocking(self.processingLock):
|
with nonBlocking(self.processingLock):
|
||||||
|
if len(self.read_buf) < self.expectBytes:
|
||||||
|
return False
|
||||||
if getattr(self, "state_" + str(self.state))() is False:
|
if getattr(self, "state_" + str(self.state))() is False:
|
||||||
break
|
break
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user