diff options
author | Linus Nordberg <linus@torproject.org> | 2013-06-05 15:48:57 +0200 |
---|---|---|
committer | Linus Nordberg <linus@torproject.org> | 2013-06-18 12:19:09 +0200 |
commit | dfa4cd3a77ff5e5b3b2dfefff167efad3f546a8e (patch) | |
tree | eeabf656b41c32f62ec358597b55bc557c410316 /lib | |
parent | 19abaf8052e8a561536ec102f1c4f624d2494de6 (diff) | |
download | chutney-dfa4cd3a77ff5e5b3b2dfefff167efad3f546a8e.tar chutney-dfa4cd3a77ff5e5b3b2dfefff167efad3f546a8e.tar.gz |
Use values from errno instead of literal constants.
Now it might even have a chance of working on non-linuxes!
Diffstat (limited to 'lib')
-rw-r--r--[-rwxr-xr-x] | lib/chutney/Traffic.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/chutney/Traffic.py b/lib/chutney/Traffic.py index 4ab4fff..efee8e2 100755..100644 --- a/lib/chutney/Traffic.py +++ b/lib/chutney/Traffic.py @@ -9,6 +9,7 @@ import socket import select import struct +import errno debug_flag = False @@ -138,7 +139,7 @@ class Source(Peer): try: self.s.connect(dest) except socket.error, e: - if e[0] != 115: # EINPROGRESS + if e[0] != errno.EINPROGRESS: raise def on_readable(self): @@ -176,7 +177,7 @@ class Source(Peer): try: n = self.s.send(self.outbuf) except socket.error, e: - if e[0] == 111: # ECONNREFUSED + if e[0] == errno.ECONNREFUSED: debug("connection refused (fd=%d)" % self.fd()) return -1 raise @@ -185,7 +186,7 @@ class Source(Peer): if self.state == self.CONNECTING_THROUGH_PROXY: return 1 # Keep us around. return len(self.outbuf) # When 0, we're being removed. - + class TrafficTester(): def __init__(self, endpoint, data={}, timeout=3): self.listener = Listener(self, endpoint) |