Code review comment for lp:~vila/bzr/405745-http-hangs

Revision history for this message
Andrew Bennetts (spiv) wrote :

+ def connect_socket(self):
+ msg = "getaddrinfo returns an empty list"
+ for res in socket.getaddrinfo(*self.server_address):
[...]
+ except socket.error, msg:
+ if sock is not None:
+ sock.close()
+ raise socket.error, msg
+

"except socket.error, msg" is bogus, especially when "msg" was a string earlier. It's also a bit arbitrary to that if no addresses work that this will raise an error from the last address, rather than the first, or some sort of aggregation.

I'd probably write this as:
    err = socket.error("getaddrinfo returned an empty list")
    for ...
        except socket.error, err:
            # 'err' is now the most recent error
            if sock is not None:
                sock.close()
    raise err

Otherwise this seems ok. bb:tweak.

review: Needs Fixing

« Back to merge proposal