(self)
| 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]) |
no test coverage detected