Avoid asyncore race condition on write availability
This commit is contained in:
@@ -38,6 +38,8 @@ Bug Fixes
|
||||
* Avoid UnicodeDecodeError when query string is unicode (PYTHON-76)
|
||||
* Correctly capture dclocal_read_repair_chance for tables and
|
||||
use it when generating CREATE TABLE statements (PYTHON-84)
|
||||
* Avoid race condition with AsyncoreConnection that may cause messages
|
||||
to fail to be written until a new message is pushed
|
||||
|
||||
2.0.2
|
||||
=====
|
||||
|
@@ -262,12 +262,12 @@ class AsyncoreConnection(Connection, asyncore.dispatcher):
|
||||
|
||||
def handle_write(self):
|
||||
while True:
|
||||
try:
|
||||
with self.deque_lock:
|
||||
with self.deque_lock:
|
||||
try:
|
||||
next_msg = self.deque.popleft()
|
||||
except IndexError:
|
||||
self._writable = False
|
||||
return
|
||||
except IndexError:
|
||||
self._writable = False
|
||||
return
|
||||
|
||||
try:
|
||||
sent = self.send(next_msg)
|
||||
@@ -318,8 +318,7 @@ class AsyncoreConnection(Connection, asyncore.dispatcher):
|
||||
|
||||
with self.deque_lock:
|
||||
self.deque.extend(chunks)
|
||||
|
||||
self._writable = True
|
||||
self._writable = True
|
||||
|
||||
def writable(self):
|
||||
return self._writable
|
||||
|
Reference in New Issue
Block a user