spesmilo/electrum — pull request #549 by dmcdad (2014-01-15 14:51:47+00:00)
Title: Fix timeout problem in interface.py.

Fix timeout problem under Python 2.7.1 where a socket.error 60 is thrown instead of socket.timeout exception.

I was seeing the following exception thrown periodically:

Traceback (most recent call last):
File "/Users/mattb/Personal/Bitcoin/Electrum-1.9.6/lib/interface.py", line 421, in run_tcp
msg = self.s.recv(1024)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 219, in recv
return self.read(buflen)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 138, in read
return self._sslobj.read(len)
error: [Errno 60] Operation timed out

Based on the stack trace it looks like Python 2.7.1 ssl doesn't throw socket.timeout but instead throws socket.error with errno == 60. Proposed fix just catches that and handles it as a timeout.