Skip to content

Commit 9f444b4

Browse files
committed
In some cases, socket.write() return 0 as sent instead of raising NONBLOCKING
1 parent 15d6a22 commit 9f444b4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

cassandra/io/libevreactor.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,11 @@ def handle_write(self, watcher, revents, errno=None):
330330
if sent < len(next_msg):
331331
with self._deque_lock:
332332
self.deque.appendleft(next_msg[sent:])
333+
# we've seen some cases that 0 is returned instead of NONBLOCKING. But usually,
334+
# we don't expect this to happen. https://bugs.python.org/issue20951
335+
if sent == 0:
336+
self._socket_writable = False
337+
return
333338

334339
def handle_read(self, watcher, revents, errno=None):
335340
if revents & libev.EV_ERROR:

0 commit comments

Comments
 (0)