SSL fixes
This commit is contained in:
parent
281630757e
commit
e4a7e71790
|
@ -253,8 +253,9 @@ class receiveDataThread(threading.Thread):
|
|||
self.connectionIsOrWasFullyEstablished = True
|
||||
|
||||
self.sslSock = self.sock
|
||||
if (self.services & shared.NODE_SSL == shared.NODE_SSL and
|
||||
if ((self.services & shared.NODE_SSL == shared.NODE_SSL) and
|
||||
shared.haveSSL(not self.initiatedConnection)):
|
||||
logger.debug("Initialising TLS")
|
||||
self.sslSock = ssl.wrap_socket(self.sock, keyfile = os.path.join(shared.codePath(), 'sslkeys', 'key.pem'), certfile = os.path.join(shared.codePath(), 'sslkeys', 'cert.pem'), server_side = not self.initiatedConnection, ssl_version=ssl.PROTOCOL_TLSv1, do_handshake_on_connect=False, ciphers='AECDH-AES256-SHA')
|
||||
if hasattr(self.sslSock, "context"):
|
||||
self.sslSock.context.set_ecdh_curve("secp256k1")
|
||||
|
@ -270,7 +271,7 @@ class receiveDataThread(threading.Thread):
|
|||
except:
|
||||
break
|
||||
# Command the corresponding sendDataThread to set its own connectionIsOrWasFullyEstablished variable to True also
|
||||
self.sendDataThreadQueue.put((0, 'connectionIsOrWasFullyEstablished', (self.services, self.sslSock, self.initiatedConnection)))
|
||||
self.sendDataThreadQueue.put((0, 'connectionIsOrWasFullyEstablished', (self.services, self.sslSock)))
|
||||
|
||||
if not self.initiatedConnection:
|
||||
shared.clientHasReceivedIncomingConnections = True
|
||||
|
|
|
@ -45,6 +45,10 @@ class sendDataThread(threading.Thread):
|
|||
self.lastTimeISentData = int(
|
||||
time.time()) # If this value increases beyond five minutes ago, we'll send a pong message to keep the connection alive.
|
||||
self.someObjectsOfWhichThisRemoteNodeIsAlreadyAware = someObjectsOfWhichThisRemoteNodeIsAlreadyAware
|
||||
if self.streamNumber == -1: # This was an incoming connection.
|
||||
self.initiatedConnection = False
|
||||
else:
|
||||
self.initiatedConnection = True
|
||||
logger.debug('The streamNumber of this sendDataThread (ID: ' + str(id(self)) + ') at setup() is' + str(self.streamNumber))
|
||||
|
||||
|
||||
|
@ -175,7 +179,7 @@ class sendDataThread(threading.Thread):
|
|||
break
|
||||
elif command == 'connectionIsOrWasFullyEstablished':
|
||||
self.connectionIsOrWasFullyEstablished = True
|
||||
self.services, self.sslSock, self.initiatedConnection = data
|
||||
self.services, self.sslSock = data
|
||||
else:
|
||||
logger.error('sendDataThread ID: ' + str(id(self)) + ' ignoring command ' + command + ' because the thread is not in stream' + str(deststream))
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user