diff options
author | Rob Austein <sra@hactrn.net> | 2010-10-04 20:24:27 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2010-10-04 20:24:27 +0000 |
commit | f347d7a1347c542d9a4e9ea9b3f100674f0d094a (patch) | |
tree | 1c7bbeef9ae5c95806c92d096fe67d7d414f1756 | |
parent | 6d24ef5781a37290231543f41d6a08062d51f9e0 (diff) |
.close() doesn't take "force" argument anymore. Handle exceptions in
"closing" state as we would for "idle" state.
svn path=/rpkid.without_tls/rpki/http.py; revision=3456
-rw-r--r-- | rpkid.without_tls/rpki/http.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/rpkid.without_tls/rpki/http.py b/rpkid.without_tls/rpki/http.py index ec6200bb..498df832 100644 --- a/rpkid.without_tls/rpki/http.py +++ b/rpkid.without_tls/rpki/http.py @@ -428,14 +428,14 @@ class http_stream(asynchat.async_chat): rpki.log.traceback() if etype not in (rpki.exceptions.HTTPClientAborted,): self.log("Closing due to error", rpki.log.warn) - self.close(force = True) + self.close() def handle_timeout(self): """ Inactivity timer expired, close connection with prejudice. """ self.log("Timeout, closing") - self.close(force = True) + self.close() def handle_close(self): """ @@ -746,7 +746,7 @@ class http_client(http_stream): self.log("Timeout while in state %s" % self.state, rpki.log.warn) http_stream.handle_timeout(self) self.queue.detach(self) - if self.state != "idle": + if self.state not in ("idle", "closing"): try: raise rpki.exceptions.HTTPTimeout except rpki.exceptions.HTTPTimeout, e: @@ -835,11 +835,12 @@ class http_queue(object): processing this result, kick off next message in the queue, if any. """ - if not self.queue: - self.log("No caller, this should not happen. Dropping result %r" % result) - - req = self.queue.pop(0) - self.log("Dequeuing request %r" % req) + try: + req = self.queue.pop(0) + self.log("Dequeuing request %r" % req) + except IndexError: + self.log("No caller. THIS SHOULD NOT HAPPEN. Dropping result %r" % result, rpki.log.warn) + return try: if isinstance(result, http_response): |