Commit Graph

369 Commits

Author SHA1 Message Date
Mark Spanbroek 8d2121fa5d Rewrite test that writes long message over stream
Previous test could fail every now and then, because at the
time that the message is written, the message counter might
not have been updated completely.
2021-01-04 10:05:34 +01:00
Mark Spanbroek 1d4dafd8f9 Do not bind DatagramTransport to remote address on init
Fixes "Socket is already connected" error on macOS.
2021-01-04 10:05:34 +01:00
Mark Spanbroek e8bc63de57 Ensure that unexpected errors in send loops are raised immediately
Before this change they were silently ignored.
2021-01-04 10:05:34 +01:00
Mark Spanbroek 42115c90b5 Introduce new API for setting up connections
Unlike the ngtcp2 connections, these connections include
the UDP transport. The API is similar to BSD sockets:
dial, listen, accept.
2021-01-04 10:05:34 +01:00
Mark Spanbroek 628e1c4445 Rename: Connection -> Ngtcp2Connection 2021-01-04 10:05:34 +01:00
Mark Spanbroek 6709b4d7da Combine testConnection and testUdp 2021-01-04 10:05:34 +01:00
Mark Spanbroek 17c4a63b27 Handle recoverable errors when receiving packets
Fixes occasional hang during handshake.
2020-11-27 17:19:45 +01:00
Mark Spanbroek dde23f98bb Improve check in stream write test
Fixes intermittent test failures, when the expected
packet is preceded by an ack packet.
2020-11-27 17:19:45 +01:00
Mark Spanbroek 32815b0f2e Do not fire handshake event on client until ngtcp calls 'handshake_confirmed' 2020-11-27 17:19:45 +01:00
Mark Spanbroek c5108c6b47 Remove {.threadvar.} in async tests
A thread variable is only initialized once; this led to
re-use of the client and server over multiple tests.

Solves failing tests on Windows CI.
2020-11-25 18:00:32 +01:00
Mark Spanbroek 3c06acb627 Set CI timeout to 10 minutes
Instead of default 360 minutes.
2020-11-25 18:00:32 +01:00
Mark Spanbroek 3bfee1392b Ensure that timeout that triggers during `destroy` does not crash
Also fixes CI failure on macOS.
2020-11-25 18:00:32 +01:00
Mark Spanbroek 20a49550cd Remove DatagramBuffer alias
Because openarray is already hard enough to understand
without having an alias in between.
2020-11-25 18:00:32 +01:00
Mark Spanbroek da332593f7 Rename: connections -> simulation 2020-11-25 18:00:32 +01:00
Mark Spanbroek 02254ba9f3 Use chronos to provide timestamps 2020-11-25 18:00:32 +01:00
Mark Spanbroek 24afeaedf3 Simplify 2020-11-25 18:00:32 +01:00
Mark Spanbroek f8a11bf9f6 Avoid result variable 2020-11-25 18:00:32 +01:00
Mark Spanbroek f8a9f40ef0 Explicitly call 'destroy' to free connection resources
Current version of Nim does not always call `=destroy`.
2020-11-25 18:00:32 +01:00
Mark Spanbroek d9e333ad28 Ensure that network loops stop when simulation is cancelled 2020-11-25 18:00:32 +01:00
Mark Spanbroek a185837fb3 Avoid result variable 2020-11-25 18:00:32 +01:00
Mark Spanbroek a75bbb433c Make imports explicit using the pkg/ and ./ prefixes 2020-11-25 18:00:32 +01:00
Mark Spanbroek 59005f46af Introduce proc that installs handshake callback 2020-11-25 18:00:32 +01:00
Mark Spanbroek eef8e44fbf Introduce proc that installs connection id callback 2020-11-25 18:00:32 +01:00
Mark Spanbroek 5c220e984f Remove duplicate assignment 2020-11-25 18:00:32 +01:00
Mark Spanbroek 34bdf8f235 Introduce proc that installs all stream related callbacks 2020-11-25 18:00:32 +01:00
Mark Spanbroek f128c92df2 Introduce proc that installs all encryption related callbacks 2020-11-25 18:00:32 +01:00
Mark Spanbroek 1caf7c5a9a Fix typo 2020-11-25 18:00:32 +01:00
Mark Spanbroek 015f5ea5a5 Fix linter warnings 2020-11-25 18:00:32 +01:00
Mark Spanbroek d183c784d8 Add linter to format source files 2020-11-25 18:00:32 +01:00
Mark Spanbroek f50e242f21 Rename: crypto -> cryptodata 2020-11-25 18:00:32 +01:00
Mark Spanbroek 4c0fc92dd4 Combine encryption related modules into a single module 2020-11-25 18:00:32 +01:00
Mark Spanbroek c5bc5be9ba Rename procs to better indicate that they are callbacks 2020-11-25 18:00:32 +01:00
Mark Spanbroek 58e2aba9d1 Update to latest install-nim version
Fixes failing github action due to use of deprecated API.
2020-11-19 16:54:40 +01:00
Mark Spanbroek a4bb6b1e35 Set AEAD length to avoid assertion failure in ngtcp2 2020-11-19 16:54:40 +01:00
Mark Spanbroek ef194c8ab0 Change TLS interactions to match ngtcp2 example client and server 2020-11-19 16:54:40 +01:00
Mark Spanbroek ce26a76bd1 Update ngtcp2 dependency
Ngtcp2 has been registered as a nimble package.
2020-11-19 16:54:40 +01:00
Mark Spanbroek 6d9483985d Refactor dummy key handling code
Resembles the ngtcp2 crypto flow more now.
2020-11-19 16:54:40 +01:00
Mark Spanbroek 14fd4ff129 Reorder invocations to match ngtcp2 TLS implementation 2020-11-19 16:54:40 +01:00
Mark Spanbroek 056859ecd5 Handle packet loss by introducing a timeout at connection level 2020-11-19 16:54:40 +01:00
Mark Spanbroek bad48b071f Simplify 2020-11-19 16:54:40 +01:00
Mark Spanbroek 85e697b1db Timeout can be set to a moment in time 2020-11-19 16:54:40 +01:00
Mark Spanbroek 3ef5bb2c44 Move Connection.send() and .receive() into 'connection' module 2020-11-19 16:54:40 +01:00
Mark Spanbroek 138ef9dcb1 Rewrite timer tests to handle timer imprecision on macOS 2020-11-19 16:54:40 +01:00
Mark Spanbroek e4a3a1d5e8 Allow Timeout to be constructed without specifying duration 2020-11-19 16:54:40 +01:00
Mark Spanbroek 930f599c73 When timeout tests fail, print duration 2020-11-19 16:54:40 +01:00
Mark Spanbroek 4cd2e7a8b9 Add callback to timeout 2020-11-19 16:54:40 +01:00
Mark Spanbroek c2a9924dfa Introduce Timeout object 2020-11-19 16:54:40 +01:00
Mark Spanbroek 613fd8318e Provide correct timestamps to ngtcp2 2020-11-19 16:54:40 +01:00
Mark Spanbroek d17f733059 Remove send loops, fixes hangs
Instead of constantly trying to send, only send in response to
an incoming datagram.

The send loop in handshake() is replaced by an AsyncEvent.
2020-11-09 16:40:59 +01:00
Mark Spanbroek 871a3f4b91 Update to latest ngtcp2 2020-11-09 16:40:59 +01:00