* Refactor chronos trackers to be more simple.
* Refactor trackers.
Add HTTP server trackers.
Refactor HTTP main processing loop.
* Compatibility fixes.
Add checkLeaks().
* Fix posix test issue.
* Add httpdebug module which introduces HTTP connection dumping helpers.
Add tests for it.
* Recover and deprecate old version of Trackers.
* Make public iterators to iterate over all tracker counters available.
Fix asynctests to use public iterators instead private one.
* Disable HTTP/1.1 pipeline support for HTTP/S server by default.
Add tests.
* Fix tests according to new behavior.
Fix tests to use random assigned OS ports instead of predefined.
* Fix flaky tests in testasyncstream.
* 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>
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.
* 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
* 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.
* Restore functionality of zero-sized bounded reader/writer streams.
Adding tests for it.
* run build_nim.sh unconditionally
Co-authored-by: Ștefan Talpalaru <stefantalpalaru@yahoo.com>
* exception tracking
This PR adds minimal exception tracking to chronos, moving the goalpost
one step further.
In particular, it becomes invalid to raise exceptions from `callSoon`
callbacks: this is critical for writing correct error handling because
there's no reasonable way that a user of chronos can possibly _reason_
about exceptions coming out of there: the event loop will be in an
indeterminite state when the loop is executing an _random_ callback.
As expected, there are several issues in the error handling of chronos:
in particular, it will end up in an inconsistent internal state whenever
the selector loop operations fail, because the internal state update
functions are not written in an exception-safe way. This PR turns this
into a Defect, which probably is not the optimal way of handling things
- expect more work to be done here.
Some API have no way of reporting back errors to callers - for example,
when something fails in the accept loop, there's not much it can do, and
no way to report it back to the user of the API - this has been fixed
with the new accept flow - the old one should be deprecated.
Finally, there is information loss in the API: in composite operations
like `poll` and `waitFor` there's no way to differentiate internal
errors from user-level errors originating from callbacks.
* store `CatchableError` in future
* annotate proc's with correct raises information
* `selectors2` to avoid non-CatchableError IOSelectorsException
* `$` should never raise
* remove unnecessary gcsafe annotations
* fix exceptions leaking out of timer waits
* fix some imports
* functions must signal raising the union of all exceptions across all
platforms to enable cross-platform code
* switch to unittest2
* add `selectors2` which supercedes the std library version and fixes
several exception handling issues in there
* fixes
* docs, platform-independent eh specifiers for some functions
* add feature flag for strict exception mode
also bump version to 3.0.0 - _most_ existing code should be compatible
with this version of exception handling but some things might need
fixing - callbacks, existing raises specifications etc.
* fix AsyncCheck for non-void T
1. Implement all read() primitives using readLoop() like it was done in streams.
2. Fix readLine() bug.
3. Add readMessage() primitive.
4. Fixing exception hierarchy, handling code and simplification of (break/continue + exception).
5. Fix TLSStream closure procedure.
6. Add BoundedStream stream and tests.
7. Remove `result` usage from the code.
* Fix cancellation behavior.
Fix some compilation warnings.
* Fix cancelAndWait() and add proper documentation.
* Add completed(Future) and done(Future) calls to check if Future[T] completed without an error.
* Add stepsAsync() and tests.
* Fix comments.
* Fix new primitive comment, to avoid usage for task switches.