Fixed missing check for socket state
This commit is contained in:
parent
76fcad0b53
commit
88b88b9b64
@ -531,11 +531,13 @@ class I2PInterfacePeer(Interface):
|
|||||||
if callable(socket.close):
|
if callable(socket.close):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if self.socket != None:
|
||||||
socket.shutdown(socket.SHUT_RDWR)
|
socket.shutdown(socket.SHUT_RDWR)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("Error while shutting down socket for "+str(self)+": "+str(e))
|
RNS.log("Error while shutting down socket for "+str(self)+": "+str(e))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
if self.socket != None:
|
||||||
socket.close()
|
socket.close()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("Error while closing socket for "+str(self)+": "+str(e))
|
RNS.log("Error while closing socket for "+str(self)+": "+str(e))
|
||||||
@ -677,6 +679,7 @@ class I2PInterfacePeer(Interface):
|
|||||||
|
|
||||||
if (time.time()-self.last_write > I2PInterfacePeer.I2P_PROBE_AFTER*1):
|
if (time.time()-self.last_write > I2PInterfacePeer.I2P_PROBE_AFTER*1):
|
||||||
try:
|
try:
|
||||||
|
if self.socket != None:
|
||||||
self.socket.sendall(bytes([HDLC.FLAG, HDLC.FLAG]))
|
self.socket.sendall(bytes([HDLC.FLAG, HDLC.FLAG]))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("An error ocurred while sending I2P keepalive. The contained exception was: "+str(e), RNS.LOG_ERROR)
|
RNS.log("An error ocurred while sending I2P keepalive. The contained exception was: "+str(e), RNS.LOG_ERROR)
|
||||||
|
Loading…
Reference in New Issue
Block a user