Merged revisions 86391 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r86391 | antoine.pitrou | 2010-11-10 09:59:25 +0100 (mer., 10 nov. 2010) | 4 lines Followup to r86383: it seems that in some cases (buildbots), the server closes the connection before we can call shutdown(). ........
This commit is contained in:
parent
e87875bfad
commit
0a69b856d5
|
@ -22,7 +22,7 @@ Public functions: Internaldate2tuple
|
||||||
|
|
||||||
__version__ = "2.58"
|
__version__ = "2.58"
|
||||||
|
|
||||||
import binascii, random, re, socket, subprocess, sys, time
|
import binascii, errno, random, re, socket, subprocess, sys, time
|
||||||
|
|
||||||
__all__ = ["IMAP4", "IMAP4_stream", "Internaldate2tuple",
|
__all__ = ["IMAP4", "IMAP4_stream", "Internaldate2tuple",
|
||||||
"Int2AP", "ParseFlags", "Time2Internaldate"]
|
"Int2AP", "ParseFlags", "Time2Internaldate"]
|
||||||
|
@ -260,7 +260,13 @@ class IMAP4:
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
"""Close I/O established in "open"."""
|
"""Close I/O established in "open"."""
|
||||||
self.file.close()
|
self.file.close()
|
||||||
|
try:
|
||||||
self.sock.shutdown(socket.SHUT_RDWR)
|
self.sock.shutdown(socket.SHUT_RDWR)
|
||||||
|
except socket.error as e:
|
||||||
|
# The server might already have closed the connection
|
||||||
|
if e.errno != errno.ENOTCONN:
|
||||||
|
raise
|
||||||
|
finally:
|
||||||
self.sock.close()
|
self.sock.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue