59 Commits

Author SHA1 Message Date
cheatfate
c8f650e651
Bump version to 3.2.1. 2023-07-14 14:57:24 +03:00
tersec
2c7774d982
drop support for Nim 1.2, 1.4, add Nim 2.0 to CI testing matrix (#378)
* add Nim 2.0 to CI testing matrix

* Deprecate 1.2 and 1.4 testing branches.

---------

Co-authored-by: cheatfate <eugene.kabanov@status.im>
2023-06-04 09:51:02 +02:00
Jacek Sieka
ba143e029f
version 3.2.0 (#399)
last version to support Nim 1.2, 1.4 - may receive critical backports
but otherwise this is EOL for said Nim versions
2023-06-04 09:46:04 +02: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
Jacek Sieka
189f6e390c
normalise nimble file (#331)
* normalise nimble file

* abort redundant builds

* bump checkout
2022-11-23 06:54:10 +01:00
Ivan Yonchovski
59f611f0fc
Use unittest2 directly (#291) 2022-06-29 17:22:57 +03:00
Ștefan Talpalaru
17fed89c99
style fixes (#253)
* style fixes

and disable the cron CI job
2022-01-04 23:14:30 +01:00
Jacek Sieka
0fc82049ac enable --styleCheck:usages 2021-12-27 17:33:25 +02:00
Jacek Sieka
c25fa1f6cd
posix: fast path for write (#244)
When `write` is called on a `StreamTransport`, the current sequence of
operations is:

* copy data to queue
* register for "write" event notification
* return unfinished future to `write` caller
* wait for "write" notification (in `poll`)
* perform one `send`
* wait for notification again if there's more data to write
* complete the future

In this PR, we introduce a fast path for writing:

* If the queue is empty, try to send as much data as possible
  * If all data is sent, return completed future without `poll` round
  * If there's more data to send than can be sent in one go, add the
rest to queue
* If the queue is not empty, enqueue as above
* When notified that write is possible, keep writing until OS buffer is
full before waiting for event again

The fast path provides significant performance benefits when there are
many small writes, such as when sending gossip to many peers, by
avoiding the poll loop and data copy on each send.

Also fixes an issue where the socket would not be removed from the
writer set if there were pending writes on close.
2021-12-08 11:35:27 +01:00
Eugene Kabanov
7da1f5d4d2
Bump version to 3.0.9. (#249) 2021-12-03 15:32:58 +02:00
Ștefan Talpalaru
25ccbb0beb
version 3.0.8 2021-11-20 01:31:09 +01:00
Ștefan Talpalaru
b24ee653d3
version 3.0.7 2021-11-19 01:08:55 +01:00
Miran
3697426f85
properly move testing libbacktrace to a separate task (#236)
This is a continuation of #231.
2021-11-15 11:40:49 +01:00
Ștefan Talpalaru
df980dd713
CI: separate libbacktrace test in its own task (#231) 2021-11-08 19:09:06 +02:00
Eugene Kabanov
ef2430d08d
Add Accept header handling to httpserver.nim. (#211)
* Add `Accept` header handling to httpserver.nim.
Add simple test suite.
Bump version to 3.0.6.

* Fix compilation error.
2021-07-28 17:08:38 +03:00
Eugene Kabanov
15137f71c3
Basic authorization implementation for HTTP client. (#204)
* Basic authorization implementation for HTTP client.
Add tests for basic authorization.

* Bump chronos version to 3.0.5.
2021-06-29 02:38:08 +03:00
Eugene Kabanov
7ccb170f7a
Enable comma as array delimiter and adding tests. (#191)
* Enable comma as array delimiter and adding tests.

* Bump version to 3.0.4.
2021-05-17 22:39:24 +03:00
cheatfate
67f0f1224f
Bump nimble version.
Make some useful fields public.
2021-05-10 10:40:56 +03:00
Ștefan Talpalaru
c15c985c1f
support nimStackTraceOverride (#181) 2021-05-06 09:49:55 +02:00
Eugene Kabanov
aab1e30a72
Refactor common.nim and add more resolve procedures. (#177)
* Refactor common.nim to remove `result` usage.
Fix comparison of TransportAddress issue.
Add resolveTAddress procedures for both IPv4 and IPv6 addresses.
Fix tests.

* Bump version to 3.0.2.
2021-04-10 00:39:54 +03:00
Jacek Sieka
895fc53193
add explicit gcsafe annotations (fixes #174) (#175)
Seems like a variation of https://github.com/nim-lang/Nim/issues/17369
2021-04-03 10:05:08 +02:00
Jacek Sieka
4abd7a5645
exception tracking (#166)
* 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
2021-03-24 10:08:33 +01:00
Eugene Kabanov
f774644129
Fix integer decoding overflow issue. (#163)
Switch to stew.base10 procedures.
Adjust tests to follow new behavior.
Bump version to 2.6.1.
2021-03-06 00:22:32 +02:00
Andreas Rumpf
1324b2f787
Enable --gc:orc testing for nim-chronos (#161)
* enable --gc:orc testing on nim devel (1.5.x)
2021-03-03 20:04:09 +02:00
cheatfate
1243aef627
Bump chronos version to 2.6.0. 2021-03-02 15:27:42 +02:00
cheatfate
789a5f8252 Fix dependency name. 2021-02-18 22:16:04 +02:00
cheatfate
53aec163eb Fix nimble dependencies. 2021-02-18 22:16:04 +02:00
Eugene Kabanov
a5442edfc0
Add asyncSpawn() procedure and tests. (#123)
Deprecated asyncDiscard() procedure.
Bump version to 2.5.2.
2020-09-01 21:41:18 +03:00
Zahary Karadjov
e6d50b7736 Revert "some metrics for monitoring futures (#85)"
This reverts commit e45ef32b5b7b1ed49ffcc52f39f42b7c30fab564.

Metrics implemented this way, with a lock inside the otherwise tight
event loop are not consistent with the chronos architecture that for
good or bad uses thread local variables to avoid them - the solution
does not have rough consensus behind it, and other avenues should be
explored for this generally useful functionality.
2020-08-16 01:48:25 +03:00
Ștefan Talpalaru
e45ef32b5b
some metrics for monitoring futures (#85) 2020-08-06 19:30:53 +02:00
Jacek Sieka
f856c885fa
fix endian conversion issues (#82)
* fixes call to `bigEndian32` on a uint64 which breaks on big endian
platforms
* prefer endians2 for less and safer code
2020-07-12 18:22:47 +02:00
Jacek Sieka
8b8a1e793d
bump supported nim version 2020-07-12 18:20:21 +02:00
Eugene Kabanov
ce6e7d17b1
Make Future tracking and stack traces optional (#108)
* Make Future tracking optional via -d:chronosDutureTracking compilation flag.
* Stack traces is now optional, use -d:chronosStackTraces.
* Fix mistypes and add test for chronosStackTrace option.
2020-07-08 19:48:01 +03:00
Eugene Kabanov
5629b3c41f
[WIP] Zero-cost unattended Future[T] tracking mechanism. (#106)
* Zero-cost unattended Future[T] tracking mechanism with tests and tracking of test suite.
2020-07-06 09:33:13 +03:00
Eugene Kabanov
319e2bfc09
Fix Nim's issue #13899 using #14723 and add tests. (#104) 2020-06-24 13:03:36 +03:00
Eugene Kabanov
02b8da986b
Add accept() call (#103)
* Add accept() call and tests.
* Fix rare fd leaks on Windows.
* Fix compilation warnings.
* Add fd leak test.
* Bump version to 2.4.0.
2020-06-24 11:21:52 +03:00
Eugene Kabanov
2ecc5500c2
Undeprecate or operation. (#93)
* Undeprecate `or` operation.
Fix `or` for already finished futures.
Add tests.

* Bump version to 2.3.9.
2020-04-21 07:07:49 +03:00
cheatfate
7ed9f1431a
Bump version to 2.3.8. 2020-03-05 20:54:57 +02:00
cheatfate
56fbdff096
Async transformed procedures will not catch Exception anymore.
Bump version to 2.3.7.
2020-03-03 13:42:43 +02:00
cheatfate
64583b4269
Fix Windows datagram's AnyAddress issue.
Add test for datagram's AnyAddress.
Bump version to 2.3.6.
2020-02-25 23:50:39 +02:00
cheatfate
74700fdcab Fix bug cancellation handlers not called in wait() and withTimeout().
Fix double completion bug because of callback race.
Fix deprecation warnings.
Rename some internal procedures.
Bump version to 2.3.5.
2020-01-27 22:32:08 +02:00
cheatfate
73c130abb4
Remove usage of getCurrentException().
Bump version to 2.3.4.
2019-11-28 20:14:19 +02:00
cheatfate
fb00b20cfa
Fix all compilation warnings for 1.0.2.
Fix all related problems.
2019-10-29 23:19:41 +02:00
cheatfate
bf393def76
Bump version to 2.3.2 2019-10-23 14:17:12 +03:00
cheatfate
c27624cfc0
Add TlsStream with client-only connections. 2019-10-08 18:46:27 +03:00
cheatfate
a039011f5b
Fix clock_gettime() is not available on old MacOS. 2019-09-03 17:30:28 +03:00
cheatfate
7029f8bc1e
Fix behavior for write operations. 2019-08-28 07:57:06 +03:00
cheatfate
03eb8a0157
Add pipe support for StreamTransport.
Bump version to 2.2.8.
2019-07-15 12:59:42 +03:00
cheatfate
4dbf4844ee
Bump version to 2.2.7. 2019-07-05 00:03:19 +03:00