Skip to content

Commit a1fc99e

Browse files
maczaly0urself
andauthored
Fix: Unwrap SSL socket before closing transport socket. (#737)
* Update connections.py Unwrap the SSL socket before closing the underlying transport socket instead of just closing SSL socket, to avoid yielding a "The TLS connection was non-properly terminated" warning in gvmd.log on disconnect. * cosmetics gvm/connections.py Co-authored-by: Jaspar S. <jaspar.stach@greenbone.net>
1 parent 227abea commit a1fc99e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

gvm/connections.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,15 @@ def connect(self):
467467
self._socket = self._new_socket()
468468
self._socket.connect((self.hostname, int(self.port)))
469469

470+
def disconnect(self):
471+
"""Close the SSL layer then disconnect from the remote server"""
472+
try:
473+
if self._socket is not None:
474+
self._socket = self._socket.unwrap()
475+
except OSError as e:
476+
logger.debug("Connection closing error: %s", e)
477+
return super(TLSConnection, self).disconnect()
478+
470479

471480
class UnixSocketConnection(GvmConnection):
472481
"""

0 commit comments

Comments
 (0)