Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose some DTLS-related features #1026

Merged
merged 16 commits into from
Nov 2, 2021
Prev Previous commit
minor tidying
  • Loading branch information
njsmith committed Nov 2, 2021
commit 85ad2a3e537219ea6d9e9372c7a229e3c08da7ef
13 changes: 7 additions & 6 deletions tests/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
SHUT_RDWR,
error,
socket,
SOCK_STREAM,
)
from os import makedirs
from os.path import join
Expand Down Expand Up @@ -173,12 +172,12 @@
"""


def socket_any_family(type=SOCK_STREAM):
def socket_any_family():
try:
return socket(AF_INET, type=type)
return socket(AF_INET)
except error as e:
if e.errno == EAFNOSUPPORT:
return socket(AF_INET6, type=type)
return socket(AF_INET6)
raise


Expand Down Expand Up @@ -4329,7 +4328,9 @@ def pump_membio(label, source, sink):
chunk = source.bio_read(LARGE_BUFFER)
except WantReadError:
return False
if not chunk:
# I'm not sure this check is needed, but I'm not sure it's *not*
# needed either:
if not chunk: # pragma: no cover
return False
# Gross hack: if this is a ClientHello, save it so we can find it
# later. See giant comment above.
Expand All @@ -4339,7 +4340,7 @@ def pump_membio(label, source, sink):
if chunk[0] == 22 and chunk[13] == 1:
nonlocal latest_client_hello
latest_client_hello = chunk
except IndexError:
except IndexError: # pragma: no cover
pass
print(f"{label}: {chunk.hex()}")
sink.bio_write(chunk)
Expand Down