Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions scapy/layers/tls/automaton.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ def __init__(self, *args, **kwargs):
kwargs["recvsock"] = lambda *args, **kwargs: None
super(_TLSAutomaton, self).__init__(*args, **kwargs)

def destroy(self, force=False):
# Automaton.destroy() does not know about the TLS socket
if getattr(self, "socket", None) is not None:
self.socket.close()
super(_TLSAutomaton, self).destroy(force=force)

def parse_args(self, mycert=None, mykey=None, **kargs):

self.verbose = kargs.pop("verbose", True)
Expand Down
1 change: 1 addition & 0 deletions test/scapy/layers/tls/tlsclientserver.uts
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ def test_tls_client(suite, version, curve=None, cookie=False, client_auth=False,
print("Server stopped. Destroying server...")
atmtsrv.destroy(force=True)
print("Server destroyed.")
assert atmtsrv.socket is None or atmtsrv.socket.fileno() == -1
# re-raise if client failed.
if final_reason:
raise ValueError(final_reason.atmt_origfunc)
Expand Down
Loading