File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ def connect(self):
4343 self .socket = socket .create_connection ((self .host , self .port ))
4444 self .socket .setsockopt (socket .SOL_TCP , socket .TCP_NODELAY , 1 )
4545 self .is_connected = True
46+ self .socket .recv (256 ) # skip greating
4647
4748 def disconnect (self ):
4849 if self .is_connected :
@@ -60,7 +61,7 @@ def opt_reconnect(self):
6061 Make use of this property and detect whether or not the socket is
6162 dead. Reconnect a dead socket, do nothing if the socket is good."""
6263 try :
63- if self .socket is None or self .socket .recv (0 , socket .MSG_DONTWAIT ) == '' :
64+ if self .socket is None or self .socket .recv (1 , socket .MSG_DONTWAIT | socket . MSG_PEEK ) == '' :
6465 self .reconnect ()
6566 except socket .error as e :
6667 if e .errno == errno .EAGAIN :
You can’t perform that action at this time.
0 commit comments