Commit Graph

616 Commits

Author SHA1 Message Date
Eugene Kabanov 8563c93673
Reexport osdefs where Sockaddr_storage was re-declared. (#385) 2023-05-12 07:11:05 +03:00
Eugene Kabanov ef94d75d61
Eliminate last 2 macos warnings. (#384) 2023-05-01 16:02:59 +03:00
Eugene Kabanov 5755d79b67
Eliminate warnings (#383)
* Eliminate warnings on Windows.

* Deprecated toHex() in osnet.
2023-05-01 00:46:15 +03:00
Eugene Kabanov 9ba418cd3b
Eliminate warnings on Windows. (#382) 2023-04-30 19:09:36 +02:00
Eugene Kabanov 3118f8c1b2
Fix cast[pointer] issues on nim-devel. (#381)
* Fix cast[pointer] issues on nim-devel.

* More cast[T] fixes.

* Fix compilation error.

* Add oserrno.nim
Further fixes for Windows and Linux.

* MacOS fixes.

* More Windows fixes and attempt to fix 1.2, 1.4 branches.

* Implicitly import/export oserrno.

* Replace oserrno with osdefs.

* Return back oserrno.

* epoll to oserrno.

* datagram/stream to oserrno.

* common to oserrno.

* test to oserrno.
2023-04-30 08:20:08 +02:00
Eugene Kabanov e05d2f8e96
Fix some compilation warnings and expose tracker names. (#376)
* Fix asyncsync compilation warnings.

* Fix tracker names should be public.
2023-04-08 19:34:57 +03:00
Tanguy ab5a8c2e0f
Add `localAddress` support to `stream.connect` (#362)
* Add `localAddress` support to `stream.connect`

* fix windows

* TransportAddress() instead of AnyAddress

* tweak flags

* Better flags

* try to workaround nim 1.2 issue

* Handle ReusePort in createStreamServer and improve tests

* Rename ClientFlags to SocketFlags

---------

Co-authored-by: Diego <diego@status.im>
2023-04-03 15:34:35 +03:00
Jacek Sieka 229de5f842
Compile-time configuration (#371)
This PR moves all compile-time configuration to a single module,
simplifying documentation and access to these features.

Upcomfing features may be enabled either individually, or through a new
`chronosPreviewV4` catch-all designed to allow code to be prepared for
increased strictness in future chronos releases.

`-d:chronosDebug` may be used to enable the existing debugging helpers
together.
2023-03-31 07:35:04 +02:00
Eugene Kabanov 1394c9e049
IOSelectors refactoring to properly support signals and processes. (AsyncProc 2) (#366)
* ioselectors_epoll() refactoring.

* ioselectors_kqueue() refactoring.

* ioselectors_poll() initial refactor.

* Remove `s.count` because it inconsistent and not used in `chronos`.

* Remove Windows version of select() engine.

* Add ability to switch event queue engine via `asyncEventEngine` command line option.

* Make it possible to switch between engines.

* Fix epoll regression.

* Fix poll() engine issues.

* Address review comments.

* Add proper trick.

* Address review comments.

* Bump version to 3.1.0.
2023-03-24 17:52:55 +02:00
Eugene Kabanov b0af576c7c
Address #320 issue. (#372) 2023-03-24 17:34:45 +02:00
Eugene Kabanov 0688d2ef8f
Add idle connection timeouts for HTTP client's connections pool. (#324)
* Add idle connection timeouts for HTTP client's connections pool.
Add timestamps and duration for both HTTP client requests/responses.
Add test.

* Add comments on `connectionFlag` decisions.

* Address review comments.
Adjust default idle connection timeout to 60 seconds.

* Increase timeout for test.

* Adjust timeout to lower value.

* Address review comments.
2023-03-21 15:10:35 +02:00
Etan Kissling 30c839bac7
fix `hasOverflow` for multiple streams (#370)
Instead of repeatedly checking stream 1, properly check all of them.
2023-03-16 11:46:24 +02:00
Eugene Kabanov f7835a192b
Fix osnet to not raise defect in ipnet. (#364)
* Debugging commit.

* Fix compilation issue.

* Remove debugging echoes.
2023-02-23 09:58:58 +02:00
Matt Haggard 1b69b5e808
Allow passing in trustAnchors to newTLSClientAsyncStream (#355)
* Allow passing in trustAnchors to newTLSClientAsyncStream

* Store X509TrustAnchors in a memory-secure, but memory-friendly way

* Remove forgotten import

* Change some waitFor to await in tests; add comment about trustAnchors reuse

* Remove use of result in newTrustAnchorStore
2023-02-21 20:38:53 +02:00
Eugene Kabanov 0f70a6b8ee
OS definitions and exceptions changes. (AsyncProc part 1). (#361)
* Initial commit.

* Finalize Windows part.

* Finalize Posix part.

* Fix style issues.

* Move osnet declarations to osdefs.

* Move osnet declarations to osdefs 2.

* Fix Nim 1.2 issues.

* Fix 1.2 compilation issues 2.

* Address review comments.
Fix SignalFdInfo issue.
2023-02-21 11:48:36 +01:00
Eugene Kabanov 77ffff322c
Fix missing decodeUrl() while decoding CommaSeparatedArray URL query parameters. (#360)
Fix unused `exc` warnings.
Fix unused ContentDisposition warning.
2023-02-17 12:52:54 +02:00
Tanguy a50ac4f642
Documentation (#311)
* Fix & update asyncloop documentation

* Add cancellation documentation

* Add documentation generation workflow

* pin nim version for doc gen

* update readme

* fix example

* Simplify examples
2023-02-16 21:27:31 +01:00
Eugene Kabanov 1e743dc415
IpNet refactoring (#354)
Remove `result` usage.
Remove cast[T] usage.
Add more helpers for TransportAddress checks.
Add isGlobal() helper to check if TransportAddress is globally accessed IP address.
Add tests.
Add more tests for sub.
Add TransportAddress.toHex().
2023-02-16 17:18:05 +01:00
Eugene Kabanov 5d3da66e56
Properly fix SIGBUS crash issue (#358)
* Fix SIGBUS crash.

* Workaround annoying and buggy style checker.

* Fix revealed SIGSEGV error.

* Add comments.
2023-02-09 07:15:22 +02:00
Eugene Kabanov b9fcf9962d
Refactor Future[T] test suite. (#359)
* Refactor testfut.nim.

* Fix location test lines.
2023-02-09 06:08:47 +02:00
Eugene Kabanov 8fcbe716b2
Add more verbose information about failure in basic auth test. (#351) 2023-01-24 01:48:31 +02:00
Tanguy 3d532b6d4a
Enable TCP client to enable TCP_NODELAY (#340)
* Enable TCP client to enable TCP_NODELAY

* add missing return

* fix
2023-01-23 11:18:12 +02:00
Jacek Sieka 40143f8798
remove lock file (#348)
The lock file breaks CI for nim devel - at minimum, there needs to be a
separate lock file for each nim version before lock files can be
introduced.
2023-01-19 17:20:26 +01:00
Tanguy f3b77d8661
Fix `async` `proc` types & small cleanups (#347)
* Fix `async` `proc` types & small cleanups

* review comments
2023-01-19 07:52:11 +01:00
Tanguy 4ada7fc0e1
Fix flaky token bucket CI (#338) 2023-01-18 16:02:00 +01:00
Jacek Sieka c65cc4c136
`async` `proc` types (#346)
Allow `type = proc(...) {.async.}` for pre-declaring async callback
types - in this case, the macro applies the correct transformation to
the return type and adds the appropriate exception / gcsafe annotations
2023-01-18 15:54:39 +01:00
Eugene Kabanov 945c304197
Address #329. (#330)
* Address #329.

* Refactor AsyncStreamReader/Writer `state` helper functions.
Fix some compilation warnings in `debugutils`.
Add multiple writes into test to check consistency.

* Fix Linux issue.
Fix warnings.
2023-01-10 18:08:54 +02:00
Bung e9f8baa6ee
fix int set (#341) 2022-12-29 12:12:12 +01:00
Bung 5d0c725463
fix int set construction (#335) 2022-12-16 10:40:33 +01:00
Tanguy 75d030ff71
Fix async macro "CannotRaise" warnings in nim >1.2 (#332) 2022-12-01 11:36:14 +01:00
Jacek Sieka 189f6e390c
normalise nimble file (#331)
* normalise nimble file

* abort redundant builds

* bump checkout
2022-11-23 06:54:10 +01:00
Eugene Kabanov 6525f4ce1d
Fix some warnings. (#310)
* Fix some warnings messages.

* More warning fixes.

* Address review comments.
Fix MacOS issues.

* More warning fixes.

* More Windows specific fixes.

* Fix macos and windows warnings.

* Fix warnings in timer.nim
Refactor to remove `result`.
Improve performance and behavior of timer to string procedure.
Add tests.
2022-11-02 08:09:15 +01:00
Tanguy 24146463a3
Token bucket (#279)
- A single sleepAsync per bucket
- Manual replenish with async
- Cancellation of consume

Co-authored-by: Jacek Sieka <jacek@status.im>
2022-11-02 08:03:19 +01:00
Eugene Kabanov 266e2c0ed2
HTTP client: Allow request connection management. (#323)
* Allow per-request connection management.
Fix NewConnectionAlways leak issue.

* Address review comment.
2022-10-13 10:18:13 +00:00
Eugene Kabanov 9df76c39df
Fix default content-type should not be sent if there is no body. (#315)
Make contentLength field publicly available.
2022-09-20 12:59:34 +00:00
Eugene Kabanov be2352027e
Fix nested waitFor (IndexError defect crash) bug. (#309)
Add IndexError crash test for Linux/MacOS.
Add Sentinel version of fix.
Add GetQueuedCompletionStatusEx() support for Windows, which allows to capture more then one event in single `poll()` call.
2022-09-16 22:34:18 +02:00
Eugene Kabanov 8e8263370b
Add more FutureBase helpers. (#304) 2022-09-12 12:11:13 +00:00
Jacek Sieka 396ed554f6
Update README.md 2022-09-06 18:50:12 +02:00
Jacek Sieka 746832384a
`Option` -> `Opt` (#307) 2022-09-05 11:08:52 +00:00
Miran 3e4b47e60a
switch CI to the supported versions of ubuntu and macos (#306)
* switch CI to the supported versions of ubuntu and macos

See:
- https://github.com/actions/runner-images/issues/6002
- https://github.com/actions/runner-images/issues/5583

* don't continue on error for Nim 1.6

* install openssl on macos for Nim devel

due to changes in https://github.com/nim-lang/Nim/pull/19814
2022-09-02 17:27:24 +02:00
Eugene Kabanov 1334cdfebd
getPreferredContentType() deprecate float math (#303)
* Deprecate float math.

* Remove unneeded helper procedures.

* Remove limitation of 99 types and comments.
2022-08-10 14:07:51 +03:00
Miran 93800879fd
make it more Nim 1.4+ compatible (#296) 2022-08-06 13:56:06 +03:00
Eugene Kabanov 15d7e0ebb7
Add optimized implementation for preferredContentType() which avoid sorting and double iteration. (#299)
Fix tests to use 80cpl.
2022-08-06 13:53:40 +03:00
Eugene Kabanov 939195626f
Use new Content-Type header value parser. (#302) 2022-08-05 19:59:26 +03:00
Eugene Kabanov 79c51914ae
Fix jigsaw test. (#301) 2022-07-30 23:16:30 +03:00
Eugene Kabanov e9d0e2d208
Apply fix for recent Nim devel changes. (#300) 2022-07-30 12:48:58 +03:00
Tanguy 41b82cdea3
Add test for nested finally transform issue (#295) 2022-07-18 23:30:27 +02:00
Jacek Sieka 2a19e4ca4c
bearssl: spelling (#294) 2022-07-16 20:46:19 +02:00
Eugene Kabanov f2e4d447d6
Workaround exception tracking issue. (#293)
* Workaround exception tracking issue.

* Fix SecureHttpServerRef too.
2022-07-04 12:31:18 +03:00
Ivan Yonchovski 59f611f0fc
Use unittest2 directly (#291) 2022-06-29 17:22:57 +03:00