Commit graph

83 commits

Author SHA1 Message Date
Marten Seemann
8e93770dd3
avoid lock contention when accepting new connections (#4313)
* avoid lock contention when accepting new connections

The server used to hold the packet handler map's lock while creating the
connection struct for a newly accepted connection. This was intended to
make sure that no two connections with the same Destination Connection
ID could be created.

This is a corner case: it can only happen if two Initial packets with
the same Destination Connection ID are received at the same time. If
the second one is received after the first one has already been
processed, it would be routed to the first connection. We don't need to
optimized for this corner case. It's ok to create a new connection in
that case, and immediately close it if this collision is detected.

* only pass 0-RTT to the connection if it was actually accepted
2024-02-08 19:34:42 -08:00
Marten Seemann
dda63b90eb
don't close established connections on Listener.Close, when using a Transport (#4072)
* don't close established connections on Listener.Close

* only close once
2023-10-26 23:10:13 -07:00
Marten Seemann
072a602cc1
pass around receivedPacket as struct instead of as pointer (#3823) 2023-06-03 00:08:58 -07:00
Marten Seemann
bc7cb706c5 add a GetConfigForClient callback to the Config 2023-05-02 15:56:49 +02:00
Marten Seemann
8189e75be6 implement the Transport 2023-05-02 15:56:48 +02:00
Marten Seemann
58487803d3 move 0-RTT queue handling from the packet handler map to the server 2023-05-01 14:24:28 +02:00
Marten Seemann
1f57d4e789
protocol: remove VersionTLS, used during the gQUIC -> TLS 1.3 transition (#3764) 2023-04-19 07:24:34 -07:00
Marten Seemann
f36690ae9c
protocol: remove VersionWhatever, previously used for testing (#3763) 2023-04-19 06:19:27 -07:00
Marten Seemann
a8a24a2bc2
add missing tracing for dropped 0-RTT packets (#3762) 2023-04-19 05:50:29 -07:00
Marten Seemann
58cedf7a4f
rename module, adjust import paths to quic-go/quic-go (#3680) 2023-01-21 19:53:57 -08:00
Marten Seemann
c24fbb094c
refactor header writing to append to a byte slice (#3646)
This avoids having to allocate a bytes.Buffer.
2023-01-17 01:56:06 -08:00
Marten Seemann
86edf7fd4b remove the LongHeader field from the wire.Header 2023-01-17 21:53:39 +13:00
Marten Seemann
8d496ebb5e
introduce a type for the stateless reset key (#3621) 2022-11-16 14:11:25 -08:00
Marten Seemann
870fbe7ab0 migrate to Ginkgo v2 2022-10-11 16:38:44 +04:00
Marten Seemann
1aced95d41 use an array instead of a byte slice for Connection IDs 2022-08-29 11:30:31 +03:00
Marten Seemann
80fd1b57c8
add a function to distinguish between long and short header packets (#3498) 2022-08-11 07:35:01 -07:00
Marten Seemann
1ae835d1d8 rename occurrences of session in client, server and packetHandlerMap 2022-03-27 11:27:25 +01:00
Marten Seemann
93cfef57ca expose a StatelessResetError 2021-05-01 09:39:51 +07:00
Marten Seemann
592fb9cad9 introduce a dedicated qerr.TransportError and qerr.ApplicationError 2021-05-01 09:38:48 +07:00
Marten Seemann
2bd316b89e store 0-RTT queues in the packet handler map
This prevents a race condition between receiving of 0-RTT packets and
the creation of new session.
2021-03-11 21:16:50 +08:00
Marten Seemann
afe287e1e0
Merge pull request #2897 from lucas-clemente/immediately-delete-stateless-reset-tokens
immediately remove reset tokens when retiring a connection ID
2020-12-04 10:14:28 +07:00
Marten Seemann
05066ae877 immediately remove reset tokens when retiring a connection ID 2020-11-22 10:21:20 +07:00
Marten Seemann
d161d7e722 remove superfluous sleep in packet handler map test 2020-11-21 16:56:42 +07:00
Marten Seemann
4c25cea9ec fix deadlock when closing the server and the connection at the same time 2020-10-29 17:56:14 +07:00
Marten Seemann
b7f05b5d86 continue listening after temporary errors 2020-09-27 15:13:09 +07:00
Marten Seemann
a65274942c use a mock net.PacketConn in tests 2020-09-27 15:13:07 +07:00
Marten Seemann
ea3d32394d read the ECN bits 2020-09-15 10:51:22 +07:00
Marten Seemann
e0824e3163 move the logging mock implementations to a separate package 2020-09-09 15:15:49 +07:00
Marten Seemann
87f53228e9 put back the packet buffer when parsing the connection ID fails 2020-08-10 09:41:43 +07:00
Marten Seemann
48e15aed92 trace dropped packets in the packet handler map 2020-07-15 20:45:38 +07:00
Marten Seemann
2f63bc0731 pass a logging.Tracer to the packet handler map 2020-07-15 20:45:36 +07:00
Marten Seemann
a1bb39d6ab introduce a protocol.StatelessResetToken 2020-07-10 19:55:20 +07:00
Marten Seemann
0ef1b2f92e pass around the stateless reset token directly, not pointers to it
Benchmarks show that it's actually faster to make a copy of this 16 byte
array than passing around a pointer to it.
2020-07-10 19:44:57 +07:00
Marten Seemann
1f676c2a6c use an errors.As comparison to detect stateless resets in the session 2020-07-10 19:43:54 +07:00
Marten Seemann
dad30e7c33 only create a single session for duplicate Initials 2020-05-29 16:04:45 +07:00
Marten Seemann
a82d6bb910 qlog stateless resets 2020-03-26 20:36:26 +07:00
Marten Seemann
93693349f3 collapse packetHandlerManager.Add and AddIfNotTaken into one function 2020-02-03 17:34:07 +01:00
Marten Seemann
634169b061 don't return a stateless reset token when adding a new connection ID
Both server and client didn't make use of the token. It was only used by
the connIDGenerator.
2020-02-03 17:31:47 +01:00
Marten Seemann
a93e544c94 remove Session.Close()
Session.Close() sends a transport-level error code. Applications should
not be able to call this function, but use CloseWithError() instead.
2020-01-26 17:41:53 +07:00
Marten Seemann
db396d8a78 rename packetHandlerMap.Close() to Destroy() 2020-01-22 17:59:22 +07:00
Marten Seemann
e65df402dd only create a single session when two Initials arrive at the same time 2019-11-30 20:01:51 +07:00
Marten Seemann
35ea8213c5 move initialization of the client's transport parameters to the session 2019-11-05 11:00:06 +07:00
Marten Seemann
ffbb810fcc retire stateless reset tokens instead of deleting them immediately 2019-11-05 10:59:21 +07:00
Marten Seemann
e55a14b8f0 remove unneccessary destroy of the session when retiring a connection ID 2019-11-01 11:53:57 +07:00
Marten Seemann
da0288b273 destroy sessions when deleting them from the packet handler map 2019-09-25 15:34:42 +07:00
Marten Seemann
96db15c836 accept smaller stateless resets 2019-08-31 12:31:41 +07:00
Marten Seemann
b3fe0fdbf9 only send stateless resets if a stateless reset key is configured 2019-03-08 18:10:16 +09:00
Marten Seemann
5c20519743 don't send stateless resets for small packets
This prevents amplification and looping.
2019-03-08 18:10:16 +09:00
Marten Seemann
94046cdb4b implement sending of stateless resets 2019-03-08 18:10:15 +09:00
Marten Seemann
dd8c590b13 add methods to add and remove reset tokens to the packet handler map 2019-03-08 18:09:37 +09:00