Use errno to test Broken pipe

The value could depend on the OS

review10691002
This commit is contained in:
Cédric Krier committed 2014-12-16 22:07:10 +01:00
1 parent cbcb1467da
commit a2dec94faa
1 file changed
+3 -2
+3 -2
View File
@@ -15,6 +15,7 @@ import StringIO
import hashlib
import base64
import threading
import errno
from functools import partial
from contextlib import contextmanager
@@ -263,8 +264,8 @@ class ServerProxy(xmlrpclib.ServerProxy):
verbose=self.__verbose
)
except (socket.error, httplib.HTTPException), v:
# trap 'Broken pipe'
if isinstance(v, socket.error) and v.args[0] != 32:
if (isinstance(v, socket.error)
and v.args[0] == errno.EPIPE):
raise
# try one more time
self.__transport.close()