Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cassandra/io/geventreactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from gevent.queue import Queue
from gevent import socket
import gevent.ssl
from greenlet import GreenletExit

import logging
import time
Expand Down Expand Up @@ -98,7 +99,10 @@ def close(self):
msg = "Connection to %s was closed" % self.endpoint
if self.last_error:
msg += ": %s" % (self.last_error,)
self.error_all_requests(ConnectionShutdown(msg))
shutdown_exc = ConnectionShutdown(msg)
self.error_all_requests(shutdown_exc)
if not self.connected_event.is_set():
self.last_error = shutdown_exc
Comment on lines -101 to +105

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same change as in #700 - it should go in a separate commit, and it of course raises the same question of mine that I asked in #700

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My comment in #700 was resolved. So my only comment here is that it should be in a separate commit

# don't leave in-progress operations hanging
self.connected_event.set()

Expand All @@ -115,6 +119,8 @@ def handle_write(self):
log.debug("Exception in send for %s: %s", self, err)
self.defunct(err)
return
except GreenletExit:
return
Comment on lines +122 to +123

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we get a deubg or trace level log here (and in the other similar place)?


def handle_read(self):
while True:
Expand All @@ -125,11 +131,15 @@ def handle_read(self):
log.debug("Exception in read for %s: %s", self, err)
self.defunct(err)
return # leave the read loop
except GreenletExit:
return

if buf and self._iobuf.tell():
self.process_io_buffer()
else:
log.debug("Connection %s closed by server", self)
self.last_error = ConnectionShutdown(
"Connection to %s was closed by server" % self.endpoint)
self.close()
return

Expand Down
Loading