File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -23,9 +23,9 @@ def read(self, length=None):
23
23
if length is not None :
24
24
return self ._fp .read (length + 2 )[:- 2 ]
25
25
return self ._fp .readline ()[:- 2 ]
26
- except socket .error , e :
26
+ except ( socket .error , socket . timeout ) , e :
27
27
raise ConnectionError ("Error while reading from socket: %s" % \
28
- e .args [ 1 ] )
28
+ ( e .args ,) )
29
29
30
30
def read_response (self ):
31
31
response = self .read ()
@@ -78,7 +78,11 @@ def on_disconnect(self):
78
78
def read_response (self ):
79
79
response = self ._reader .gets ()
80
80
while response is False :
81
- buffer = self ._sock .recv (4096 )
81
+ try :
82
+ buffer = self ._sock .recv (4096 )
83
+ except (socket .error , socket .timeout ), e :
84
+ raise ConnectionError ("Error while reading from socket: %s" % \
85
+ (e .args ,))
82
86
if not buffer :
83
87
raise ConnectionError ("Socket closed on remote end" )
84
88
self ._reader .feed (buffer )
@@ -264,8 +268,6 @@ def make_connection(self):
264
268
265
269
def release (self , connection ):
266
270
"Releases the connection back to the pool"
267
- # assert self._connection == connection
268
- # self._in_use = False
269
271
self ._in_use_connections .remove (connection )
270
272
self ._available_connections .append (connection )
271
273
You can’t perform that action at this time.
0 commit comments