Commit Graph

326 Commits

Author SHA1 Message Date
Mark Spanbroek 15e3c4cf1c New state for quic connection: disconnecting
When a quic connection is disconnecting, close the
send loop and the incoming udp connection.
2021-01-04 10:05:34 +01:00
Mark Spanbroek 2aee8ff51e Ensure that all ids of a connection are removed 2021-01-04 10:05:34 +01:00
Mark Spanbroek e9d44eadb6 Split DrainingConnection and ClosingConnection 2021-01-04 10:05:34 +01:00
Mark Spanbroek 34b88261f4 Rename: DrainingConnection -> ClosingConnection 2021-01-04 10:05:34 +01:00
Mark Spanbroek 37e5eb0eb4 Move stream sending code to ngtcp2/connection module 2021-01-04 10:05:34 +01:00
Mark Spanbroek 15c212477d Remove dead code 2021-01-04 10:05:34 +01:00
Mark Spanbroek c150cde3e6 Replace handshake event by callback on Ngtcp2Connection 2021-01-04 10:05:34 +01:00
Mark Spanbroek 3ec35363a1 Remove duplication between quicclient and quicserver 2021-01-04 10:05:34 +01:00
Mark Spanbroek 2e38637f71 Replace outgoing queue by callback in Ngtcp2Connection 2021-01-04 10:05:34 +01:00
Mark Spanbroek b7c6226fc0 Remove dead code 2021-01-04 10:05:34 +01:00
Mark Spanbroek b156e2c8f7 QuicConnection fires event when closed 2021-01-04 10:05:34 +01:00
Mark Spanbroek 2161c3b769 Combine testNgtcp2Connection & testQuicConnection 2021-01-04 10:05:34 +01:00
Mark Spanbroek cf40bc35e5 Fix onNewId() and onRemoveId() for QuicConnection 2021-01-04 10:05:34 +01:00
Mark Spanbroek e4842f9433 Run tests against QuicConnection, instead of Ngtcp2Connection 2021-01-04 10:05:34 +01:00
Mark Spanbroek d97ceef326 Use Datagram parameter instead of openArray 2021-01-04 10:05:34 +01:00
Mark Spanbroek 2b63899c74 Fix warnings about lock level
See also: https://nim-lang.github.io/Nim/manual_experimental.html#guards-and-locks-lock-levels
2021-01-04 10:05:34 +01:00
Mark Spanbroek 4d226f7906 Add unit test for example in Readme 2021-01-04 10:05:34 +01:00
Mark Spanbroek 1ba8606a7b Add allSucceeded() to async test helper. 2021-01-04 10:05:34 +01:00
Mark Spanbroek ca06e74957 Remember final connection ids when draining
Fixes problem where not all connection ids were removed
from the listener, leading to datagrams being received by
a closed connection.
2021-01-04 10:05:34 +01:00
Mark Spanbroek a01669bc5c Listener handles incoming datagrams synchrononously 2021-01-04 10:05:34 +01:00
Mark Spanbroek 0bce82225e Add Connection.close() 2021-01-04 10:05:34 +01:00
Mark Spanbroek 8899b4d9f3 Replace QuicConnection.close() with QuicConnection.drain() 2021-01-04 10:05:34 +01:00
Mark Spanbroek d2038f4fe4 Close connection gracefully 2021-01-04 10:05:34 +01:00
Mark Spanbroek 47e9bf7a36 Simplify connection states
Introduces 'enter' method that supplies the connection, instead of
having it as an argument to all other methods.
2021-01-04 10:05:34 +01:00
Mark Spanbroek 364f1221c0 Simplify stream states
Introduces 'enter' method that supplies the stream, instead of
having it as an argument to all other methods.
2021-01-04 10:05:34 +01:00
Mark Spanbroek 029b3735b3 Replace object of procs with methods for stream state 2021-01-04 10:05:34 +01:00
Mark Spanbroek 589b3758c5 Replace object of procs with methods for connection state 2021-01-04 10:05:34 +01:00
Mark Spanbroek 8d5fb399a2 Add tests for connection in closed state 2021-01-04 10:05:34 +01:00
Mark Spanbroek 2596b65352 Rename tests to better describe the current situation 2021-01-04 10:05:34 +01:00
Mark Spanbroek e6d17d59f1 Introduce closed state for connections 2021-01-04 10:05:34 +01:00
Mark Spanbroek 9c392c37b2 Rename stream state constructors
newState -> newStreamState
newOpenState -> newOpenStream
newClosedState -> newClosedStream
2021-01-04 10:05:34 +01:00
Mark Spanbroek 376c359a5f Rename ngtcp2 connection constructors
newClientConnection -> newNgtcp2Client
newServerConnection -> newNgtcp2Server
2021-01-04 10:05:34 +01:00
Mark Spanbroek 61d1f07df8 Introduce state pattern for Quic Connections
Separates a Connection from its ngtcp2 implementation specifics.
Currently only one state (open); other states will be added soon.
2021-01-04 10:05:34 +01:00
Mark Spanbroek 012d4dafcd Separate udp, transport and helper folders 2021-01-04 10:05:34 +01:00
Mark Spanbroek a50a987542 Introduce state pattern for Streams
Streams can now be in one of two states: open or closed.
Separates a Stream from its ngtcp2 implementation specifics.
Breaks the circular dependency between Connection and Stream,
allowing them to be defined in separate modules.
2021-01-04 10:05:34 +01:00
Mark Spanbroek 4c005eee37 Rename: Connection.close() -> Connection.drop() 2021-01-04 10:05:34 +01:00
Mark Spanbroek cb29e8242a Add examples and update roadmap in Readme 2021-01-04 10:05:34 +01:00
Mark Spanbroek e9248dce75 Api for reading from and writing to streams 2021-01-04 10:05:34 +01:00
Mark Spanbroek bf00310a2c Remove connection ids when they expire 2021-01-04 10:05:34 +01:00
Mark Spanbroek 226198b544 Remove ids from listener when closing connection 2021-01-04 10:05:34 +01:00
Mark Spanbroek 206117ab40 Move most of the logic from api into listener and connection
Ensures that the internals of listener and connection are hidden.
2021-01-04 10:05:34 +01:00
Mark Spanbroek eb82f37ac7 Do not close udp listening socket when closing connection 2021-01-04 10:05:34 +01:00
Mark Spanbroek 3b9dfbd544 Ensure that all connections are closed in listener test 2021-01-04 10:05:34 +01:00
Mark Spanbroek db54516c0f Formatting 2021-01-04 10:05:34 +01:00
Mark Spanbroek 124ac8152f Listener only creates new connection for unknown connection id 2021-01-04 10:05:34 +01:00
Mark Spanbroek 49350432af Add test for listener 2021-01-04 10:05:34 +01:00
Mark Spanbroek 389357b5d1 Add test helper for sending udp datagrams 2021-01-04 10:05:34 +01:00
Mark Spanbroek 58516598ab Add async test helper for callback functions 2021-01-04 10:05:34 +01:00
Mark Spanbroek 2883d3b92b Handle zero-length connection ids 2021-01-04 10:05:34 +01:00
Mark Spanbroek 7ab0ecbaf8 Accept multiple incoming connections
Introduces table to keep track of connection ids.
2021-01-04 10:05:34 +01:00