[FIX] core: no traceback when closing socket.

Closes 5057
This commit is contained in:
Christophe Simonis 2015-04-20 11:54:58 +02:00
parent 21d3be87b3
commit a091de8d8d
1 changed files with 4 additions and 0 deletions

View File

@ -57,6 +57,10 @@ def close_socket(sock):
try:
sock.shutdown(socket.SHUT_RDWR)
except socket.error, e:
if e.errno == errno.EBADF:
# Werkzeug > 0.9.6 closes the socket itself (see commit
# https://github.com/mitsuhiko/werkzeug/commit/4d8ca089)
return
# On OSX, socket shutdowns both sides if any side closes it
# causing an error 57 'Socket is not connected' on shutdown
# of the other side (or something), see