Commit Graph

381 Commits

Author SHA1 Message Date
diegomrsantos ddcb31ffb7
chore: add support for i386 (#52)
This PR reuses the `install_nim` action from `nim-libp2p`to install Nim
`i386`. We aren't running the test on `i386`- as GitHub runners are
amd64, but only using Nim `i386`.

It also uses `int64` instead of `int` for `VarIntCompatible` and
`PacketNumber` to support `i386`.
2024-09-11 16:11:31 +02:00
diegomrsantos 8a97eeeb80
chore: add support for Nim 2 (#51)
- Add Nim 2.0.8 to CI.
- Increase CI timeout to 30 minutes as the macOS building was timing out
during Nim installation.
- Use `refc` memory management.
- Upgrade ngtcp2 to a version that works with Nim 2.0.8.
- Use int instead of uint64 for `PacketNumber` and `VarIntCompatible` as
it makes implementation easier and avoids a lot of casts.
- Add required {.gcsafe.} in some procs.

fixes https://github.com/vacp2p/nim-quic/issues/43
2024-09-10 18:46:19 +02:00
diegomrsantos 57562b7f96
fix: doesn't fail loop fut if it is already finished (#50)
It was raising a defect on nim-libp2p tests sometimes as a future can't
fail if it is already finished.
2024-09-03 10:57:14 +02:00
diegomrsantos 7e450f15cc
chore: remove remote addr from log (#49)
Using this in nim-libp2p creates the error:


`/Users/runner/work/nim-libp2p/nim-libp2p/nimbledeps/pkgs/json_serialization-#85b7ea093cb85ee4f433a617b97571bd709d30df/json_serialization/writer.nim(249,
12) Error: fatal error: Failed to convert to JSON an unsupported type:
Port`

Also

```nim
import json_serialization/writer
import chronos

toJSON(initTAddress("127.0.0.1:1234"))
```

fails with


/nim-libp2p/nimbledeps/pkgs/json_serialization-#8a4ed98bbd0a9479df15af2fa31da38a586ea6d5/json_serialization/writer.nim(203,
8) template/generic instantiation of enumInstanceSerializedFields from
here

/nim-libp2p/nimbledeps/pkgs/serialization-#298a9554a885b2df59737bb3461aac8d0d339724/serialization/object_serialization.nim(48,
40) Error: type mismatch: got <uint16>
but expected one of:
iterator fieldPairs[S: tuple | object; T: tuple | object](x: S; y: T):
tuple[
    key: string, a, b: RootObj]
  first type mismatch at position: 1
  required type for x: S: tuple or object
  but expression 'value' is of type: uint16
iterator fieldPairs[T: tuple | object](x: T): tuple[key: string, val:
RootObj]
  first type mismatch at position: 1
  required type for x: T: tuple or object
  but expression 'value' is of type: uint16

expression: fieldPairs(value) 
Those are the last commits for nim-json-serialization and
nim-serialization
2024-09-02 20:26:00 +02:00
diegomrsantos d0f7099fa1
chore: upgrade chronos (#48)
Upgrade chronos to latest version.
2024-09-02 19:20:51 +02:00
diegomrsantos bd4ac461e1
chore: update nim-ngtcp2 to latest version (#45)
Updates nim-ngtcp2 to 0.34.0. This nim-ngtcp2 version uses ngtcp2 1.6.0.
2024-08-30 14:02:05 +02:00
diegomrsantos ce555a7731
chore(deps): remove upraises (#44)
Removes upraises. One of the tasks in
https://github.com/vacp2p/nim-quic/issues/37.
2024-08-14 18:46:41 +02:00
diegomrsantos f0c6b05498
chore: add initial logging (#42)
This PR adds the logs used to find the cause of the deadlock fixed in
ca9a029b63.

Related to https://github.com/status-im/nim-quic/pull/41
2024-08-14 16:07:26 +02:00
diegomrsantos 27bd6b2970
fix: make the tests pass (#41)
- upgrade dependencies
- fix compilation issues
- fix deadlock in test
2024-07-05 14:24:02 +02:00
Tanguy e04a515599
Add remoteAddress and localAddress (#40) 2023-01-17 18:06:36 +01:00
Tanguy 9dd9b528cf
Switch to results.Opt (#38)
* Give more time for CI

Lastest Nim release takes too long to build
2022-09-28 16:21:25 +02:00
Tanguy 26b1c76f85
bump ngtcp2 2022-08-26 12:34:00 +02:00
Tanguy 084413c986
Remove asynctest (#36) 2022-08-25 14:37:35 +02:00
Tanguy 7e432aeb5c
Remove Questionable (#35) 2022-08-25 13:19:27 +02:00
Tanguy e48bc4547f
Fix helpers.contains for Nim > 1.4 (#34) 2022-06-20 15:20:47 +02:00
Tanguy 3f36babc4f
Allow chronos strictExceptions (#33)
* Allow chronos strictExceptions
* Disable stable on CI
2022-06-17 18:41:06 +02:00
Mark Spanbroek 626d18dec8 Close streams when the underlying connection is closed. 2021-09-21 15:10:03 +02:00
Mark Spanbroek 31cd1d5839 Check that options have value before using them 2021-08-31 11:36:30 +02:00
Mark Spanbroek 1f6b840ebf Drop connection when underlying UDP transport fails 2021-08-03 11:13:16 +02:00
Mark Spanbroek 0d9eb9edc5 Adds bi-directional streams
These are now the default when opening a stream.
2021-07-13 08:57:07 +02:00
Mark Spanbroek dcf80a524b Update asynctest to 0.3.0 2021-07-07 11:02:19 +02:00
Mark Spanbroek 8edba5e448 Combine common imports into "basics" module 2021-06-16 10:53:18 +02:00
Mark Spanbroek 334043fccc Check that errors are raised when underlying connection has closed 2021-06-16 10:53:18 +02:00
Mark Spanbroek 88af9b568e Move errorAsDefect macro to errors module 2021-06-16 10:53:18 +02:00
Mark Spanbroek 9375399a39 Introduce QuicException and QuicDefect base classes 2021-06-16 10:53:18 +02:00
Mark Spanbroek e24a9cb169 Check that conn pointer is available before use 2021-06-16 10:53:18 +02:00
Mark Spanbroek fe46e177cc No longer reach into Ngtcp2Connection object to get ngtc2_conn pointer 2021-06-16 10:53:18 +02:00
Mark Spanbroek 84f080b75b Knowledge about ngtcp2 is moved down into the state machine 2021-06-16 10:53:18 +02:00
Mark Spanbroek 49016fff3c Set ngtcp2 callbacks when entering open connection state 2021-06-16 10:53:18 +02:00
Mark Spanbroek e411151cac Set id callbacks when entering open connection state 2021-06-16 10:53:18 +02:00
Mark Spanbroek 6401528bf6 Expose parseDatagram at the transport level
So that listener doesn't have to import
native code directly.
2021-06-16 10:53:18 +02:00
Mark Spanbroek b7591ee8c6 Code that uses ngtcp2 library is moved into `native` folder 2021-06-16 10:53:18 +02:00
Mark Spanbroek ca976f74ed Cleanup 2021-06-16 10:53:18 +02:00
Mark Spanbroek 60e42c9f23 Cleanup 2021-06-16 10:53:18 +02:00
Mark Spanbroek d7d8dd846d Nim 1.4.8 2021-06-16 10:53:18 +02:00
Mark Spanbroek e88961e336 Replace nil pointers with optionals 2021-06-16 10:53:18 +02:00
Mark Spanbroek 28b1f26b8e Remove linting (not used) 2021-05-31 10:01:36 +02:00
Mark Spanbroek a793f91130 Prevent double CI runs for every pull request
Only run CI on push to main and on PRs. Non-PR branches
can be manually dispatched through the Github Actions UI.
2021-05-31 10:01:36 +02:00
Mark Spanbroek f63c959f4d Use nimcrypto instead of sysrandom
The sysrandom package fails on 32 bit windows.
2021-05-27 16:40:55 +02:00
Mark Spanbroek 8fa017b492 Use nim 1.4.6 by default in local environment
If you're using the ASDF version manager.
2021-05-27 16:40:55 +02:00
Mark Spanbroek d5766001d8 Run CI for both Nim 1.2.6 and latest 2021-05-27 16:40:55 +02:00
Mark Spanbroek 8f1010d413 Remove workaround in CI
No longer required.
2021-05-27 16:40:55 +02:00
Mark Spanbroek a4a802b97d Workaround for CI failure on Windows 2021-04-06 09:40:01 +02:00
Mark Spanbroek bf524cf70f Handle errors in timeouts
As required by latest version of Chronos.
Uses `upraises` for exception tracking across Nim 1.2 and 1.4.
Fixes Ngtcp2 error hierarchy to match that of Nim.
2021-04-06 09:40:01 +02:00
Mark Spanbroek 087be3a1b9 Limit size of stream queue
Writing to streams is blocked when the maximum stream offset
is reached. Previously we extended this offset when data was
*added* to the read queue of the receiving peer. Now we only
extend it once data has been *removed* from the queue,
thereby limiting the queue size.
2021-01-21 17:21:25 +01:00
Mark Spanbroek 867a01a2eb Add draining state for streams
So that you can read the last bytes from a stream
that was closed by the peer.
2021-01-21 17:13:37 +01:00
Mark Spanbroek bd261033e7 Switch to closed state when peer closes stream 2021-01-21 17:13:37 +01:00
Mark Spanbroek 5bb0afe175 Fix GCUnsafe2 warning 2021-01-13 09:03:35 +01:00
Mark Spanbroek 9e755eb65f Simplify tests using setup and teardown 2021-01-13 09:03:18 +01:00
Mark Spanbroek df709d277f Use package asynctest 2021-01-13 09:03:18 +01:00