Skip to content

Commit 46d78c8

Browse files
committed
quic protocol
1 parent 93a0d05 commit 46d78c8

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

‎pproxy/server.py‎

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -325,14 +325,24 @@ async def wait_open_connection(self, *args):
325325
ifself.handshakeisnotNone:
326326
ifnotself.handshake.done():
327327
awaitself.handshake
328-
reader, writer=awaitself.handshake.result().create_stream()
329328
else:
330329
self.handshake=asyncio.get_event_loop().create_future()
331-
importaioquic.asyncio
332-
self.quic_egress_acm=aioquic.asyncio.connect(self.host_name, self.port, configuration=self.quicclient)
330+
importaioquic.asyncio, aioquic.quic.events
331+
classProtocol(aioquic.asyncio.QuicConnectionProtocol):
332+
defquic_event_received(s, event):
333+
ifisinstance(event, aioquic.quic.events.HandshakeCompleted):
334+
self.handshake.set_result(s)
335+
elifisinstance(event, aioquic.quic.events.ConnectionTerminated):
336+
self.handshake=None
337+
self.quic_egress_acm=None
338+
super().quic_event_received(event)
339+
self.quic_egress_acm=aioquic.asyncio.connect(self.host_name, self.port, create_protocol=Protocol, configuration=self.quicclient)
333340
conn=awaitself.quic_egress_acm.__aenter__()
334-
self.handshake.set_result(conn)
335-
reader, writer=awaitconn.create_stream()
341+
awaitself.handshake
342+
conn=self.handshake.result()
343+
stream_id=conn._quic.get_next_available_stream_id(False)
344+
conn._quic._get_or_create_stream_for_send(stream_id)
345+
reader, writer=conn._create_stream(stream_id)
336346
self.patch_writer(writer)
337347
returnreader, writer
338348
asyncdefstart_server(self, args):

0 commit comments

Comments
(0)