]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Use errno_from_exception on error caught in Waker 1908/head
authorThomas Kluyver <thomas@kluyver.me.uk>
Wed, 7 Dec 2016 10:14:05 +0000 (11:14 +0100)
committerThomas Kluyver <thomas@kluyver.me.uk>
Wed, 7 Dec 2016 10:14:05 +0000 (11:14 +0100)
Addresses part of gh-1907

tornado/platform/common.py

index 2d4065ca633aaeb20d4cda2031687f8a1cb2513d..d78ee6866bf6a2d0fdcff137bddbbfe4d92836fd 100644 (file)
@@ -6,7 +6,7 @@ import socket
 import time
 
 from tornado.platform import interface
-
+from tornado.util import errno_from_exception
 
 def try_close(f):
     # Avoid issue #875 (race condition when using the file in another
@@ -61,7 +61,7 @@ class Waker(interface.Waker):
                 break    # success
             except socket.error as detail:
                 if (not hasattr(errno, 'WSAEADDRINUSE') or
-                        detail[0] != errno.WSAEADDRINUSE):
+                        errno_from_exception(detail) != errno.WSAEADDRINUSE):
                     # "Address already in use" is the only error
                     # I've seen on two WinXP Pro SP2 boxes, under
                     # Pythons 2.3.5 and 2.4.1.