MCPcopy Create free account
hub / github.com/apache/cassandra-python-driver / close

Method close

cassandra/io/asyncorereactor.py:373–397  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

371 self._send_options_message()
372
373 def close(self):
374 with self.lock:
375 if self.is_closed:
376 return
377 self.is_closed = True
378
379 log.debug("Closing connection (%s) to %s", id(self), self.endpoint)
380 self._writable = False
381 self._readable = False
382
383 # We don't have to wait for this to be closed, we can just schedule it
384 self.create_timer(0, partial(asyncore.dispatcher.close, self))
385
386 log.debug("Closed socket to %s", self.endpoint)
387
388 if not self.is_defunct:
389 self.error_all_requests(
390 ConnectionShutdown("Connection to %s was closed" % self.endpoint))
391
392 #This happens when the connection is shutdown while waiting for the ReadyMessage
393 if not self.connected_event.is_set():
394 self.last_error = ConnectionShutdown("Connection to %s was closed" % self.endpoint)
395
396 # don't leave in-progress operations hanging
397 self.connected_event.set()
398
399 def handle_error(self):
400 self.defunct(sys.exc_info()[1])

Callers 1

handle_closeMethod · 0.95

Calls 3

create_timerMethod · 0.95
ConnectionShutdownClass · 0.90
error_all_requestsMethod · 0.80

Tested by

no test coverage detected