Skip to content
Closed
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
14 changes: 1 addition & 13 deletions docs-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could send you my (messy and inofficial) tox.ini if you want

# by the following command:
#
# pip-compile docs-requirements.in
Expand Down Expand Up @@ -40,10 +40,6 @@ imagesize==1.4.1
# via sphinx
immutables==0.19
# via -r docs-requirements.in
importlib-metadata==6.8.0
# via sphinx
importlib-resources==6.0.0
# via towncrier
incremental==22.10.0
# via towncrier
jinja2==3.0.3
Expand All @@ -63,8 +59,6 @@ pygments==2.15.1
# via sphinx
pyopenssl==23.2.0
# via -r docs-requirements.in
pytz==2023.3
# via babel
requests==2.31.0
# via sphinx
sniffio==1.3.0
Expand Down Expand Up @@ -99,13 +93,7 @@ sphinxcontrib-serializinghtml==1.1.5
# via sphinx
sphinxcontrib-trio==1.1.2
# via -r docs-requirements.in
tomli==2.0.1
# via towncrier
towncrier==23.6.0
# via -r docs-requirements.in
urllib3==2.0.4
# via requests
zipp==3.16.2
# via
# importlib-metadata
# importlib-resources
10 changes: 1 addition & 9 deletions test-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile test-requirements.in
Expand Down Expand Up @@ -42,10 +42,6 @@ decorator==5.1.1
# via ipython
dill==0.3.7
# via pylint
exceptiongroup==1.1.2 ; python_version < "3.11"
# via
# -r test-requirements.in
# pytest
executing==1.2.0
# via stack-data
flake8==6.1.0
Expand Down Expand Up @@ -163,11 +159,7 @@ types-pyopenssl==23.2.0.2 ; implementation_name == "cpython"
typing-extensions==4.7.1
# via
# -r test-requirements.in
# astroid
# black
# ipython
# mypy
# pylint
wcwidth==0.2.6
# via prompt-toolkit
wheel==0.41.0
Expand Down
49 changes: 45 additions & 4 deletions trio/_dtls.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ class HandshakeType(enum.IntEnum):


class ProtocolVersion:
__slots__ = ()
DTLS10 = bytes([254, 255])
DTLS12 = bytes([254, 253])

Expand All @@ -115,7 +116,7 @@ class ProtocolVersion:
# network cannot *only* cause BadPacket to be raised. No IndexError or
# struct.error or whatever.
class BadPacket(Exception):
pass
__slots__ = ()


# This checks that the DTLS 'epoch' field is 0, which is true iff we're in the
Expand Down Expand Up @@ -406,6 +407,8 @@ def decode_volley_trusted(


class RecordEncoder:
__slots__ = ("_record_seq",)

def __init__(self) -> None:
self._record_seq = count()

Expand Down Expand Up @@ -648,7 +651,9 @@ def challenge_for(


class _Queue(Generic[_T]):
def __init__(self, incoming_packets_buffer: int | float):
__slots__ = ("s", "r")

def __init__(self, incoming_packets_buffer: int | float) -> None:
self.s, self.r = trio.open_memory_channel[_T](incoming_packets_buffer)


Expand Down Expand Up @@ -828,7 +833,26 @@ class DTLSChannel(trio.abc.Channel[bytes], metaclass=NoPublicConstructor):

"""

def __init__(self, endpoint: DTLSEndpoint, peer_address: Address, ctx: Context):
__slots__ = (
"endpoint",
"peer_address",
"_packets_dropped_in_trio",
"_client_hello",
"_did_handshake",
"_ssl",
"_handshake_mtu",
"_replaced",
"_closed",
"_q",
"_handshake_lock",
"_record_encoder",
"_final_volley",
"__weakref__",
)

def __init__(
self, endpoint: DTLSEndpoint, peer_address: Address, ctx: Context
) -> None:
self.endpoint = endpoint
self.peer_address = peer_address
self._packets_dropped_in_trio = 0
Expand Down Expand Up @@ -1178,7 +1202,24 @@ class DTLSEndpoint(metaclass=Final):

"""

def __init__(self, socket: _SocketType, *, incoming_packets_buffer: int = 10):
__slots__ = (
"_initialized",
"socket",
"incoming_packets_buffer",
"_token",
"_streams",
"_listening_context",
"_listening_key",
"_incoming_connections_q",
"_send_lock",
"_closed",
"_receive_loop_spawned",
"__weakref__",
)

def __init__(
self, socket: _SocketType, *, incoming_packets_buffer: int = 10
) -> None:
# We do this lazily on first construction, so only people who actually use DTLS
# have to install PyOpenSSL.
global SSL
Expand Down
Loading