Commit Graph

45 Commits

Author SHA1 Message Date
cheatfate 13eddf382d Simplification and fixes for TLSStream state machine. 2021-02-18 22:16:04 +02:00
cheatfate e8d2a3ca0a Attempt #5. 2021-02-18 22:16:04 +02:00
cheatfate 49fd70f504 Attempt #4. 2021-02-18 22:16:04 +02:00
cheatfate cf42a5455e Investigation of Linux freezes #2. 2021-02-18 22:16:04 +02:00
Eugene Kabanov 491213dfa0
Add callIdle() primitive. (#148)
* Add callIdle primitive.

* Make single idle callback to be processed by single poll() step.
Add idleAsync() primitive to allow wait for "idle" time.
Refactor some `result` usage.
2021-01-19 13:48:39 +01:00
Jacek Sieka 9a420c6b05
work around overload resolution issues (#146)
it seems that due to a naming conflict from asyncdispatch, callSoon is
deduced to raise exceptions even if it doesn't in modules that import
both, even indirectly - this patch randomly works around the issue with
some more overloads
2021-01-11 22:15:21 +01:00
Eugene Kabanov 0933feaa35
Fix callSoon to raise Defect only. (#145)
* Initial commit.

* Move pragmas to forward declaration.
Add raises to callSoon declaration.

* Fix for IOSelectorsException.
2021-01-11 18:15:23 +01:00
cheatfate 493cb1dbfd Fix behavior of wait() and withTimeout() calls to cancel and wait for result of cancelled Future[T].
Add tests.
2020-11-17 19:28:52 +02:00
Eugene Kabanov b5915ecd29
Small fixes (#134)
* 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.
2020-11-13 14:22:58 +02:00
Jacek Sieka 1ffd1cd3dc
release callback memory early (#130)
* release callback memory early

this fixes a memory leak where a deleted callback may keep references
alive until the future is finished.

In particular, when using helpers like `or` which try to remove
themselves from the callback list when a dependent future is completed,
create a reference chain between all futures in the expression - in the
pathological case where one of the futures is completes only rarely (for
example a timeout or a cancellation task), the buildup will be
significant.

* Removing unnecessary asserts, and place comments instead.
2020-09-15 10:55:43 +03:00
Zahary Karadjov e6d50b7736 Revert "some metrics for monitoring futures (#85)"
This reverts commit e45ef32b5b.

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
Zahary Karadjov 03f4a26829 Revert "yieldAsync() (#120)"
This reverts commit 284d677815.

There is no rough consensus for how this should be implemented and
whether it's needed indeed - a use case that cannot be solved with
a queue or a lock/event should be identified before pursuing this
functionality.
2020-08-16 01:48:25 +03:00
Ștefan Talpalaru 284d677815
yieldAsync() (#120) 2020-08-10 15:31:21 +02:00
Ștefan Talpalaru e45ef32b5b
some metrics for monitoring futures (#85) 2020-08-06 19:30:53 +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 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 bedd1ded5e
Properly fix cancellation race and not introduce FD leaks. (#102) 2020-06-05 19:11:51 +03: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
Dmitriy Ryajov 1c176c173d fix: restore `removeCallback` 2020-01-08 19:32:53 -06:00
Dmitriy Ryajov 0d84f273c9 make `clearTimer` inline 2020-01-08 11:23:01 -06:00
Dmitriy Ryajov 96e0206c27 reverting AsyncCallback to object 2020-01-08 11:06:56 -06:00
Dmitriy Ryajov 78953f8fc3 consolidating timers loop 2020-01-08 10:03:34 -06:00
Dmitriy Ryajov d8dd09a358 don't loop over timers heap 2020-01-07 19:06:27 -06:00
Dmitriy Ryajov d979770263 clear timers under windown as well 2020-01-07 10:22:38 -06:00
Dmitriy Ryajov b9c534724c don't scan timers heap on each remove 2020-01-06 23:26:18 -06:00
Dmitriy Ryajov 546cc36d79 fix: avoid completing future twise 2019-12-24 13:23:45 -06:00
cheatfate a7ff20b299
Fix *nix compilation problem. 2019-10-24 16:06:55 +03:00
cheatfate 29d9274e03
Fix some compilation warnings. 2019-10-24 16:01:57 +03:00
cheatfate b0fe8398e8
Fix behavior which was agreed in #46. 2019-09-23 20:24:26 +03:00
Eugene Kabanov b41af14f86 Fix emscripten compilation errors. (#46)
* Move initAPI to newDispatcher() call.
2019-09-10 13:19:49 -04:00
cheatfate 03eb8a0157
Add pipe support for StreamTransport.
Bump version to 2.2.8.
2019-07-15 12:59:42 +03:00
cheatfate 7d7753b7fd
Initial cancellation proposal. 2019-06-20 23:30:41 +03:00
Eugene Kabanov 9160dcdbba
Merge pull request #37 from status-im/asyncstream
Asynchronous streams.
2019-06-06 15:05:08 +03:00
cheatfate c27c564d47
Add oneIndex(), oneValue() which are varargs `or` operation.
Fix some deprecation warnings for Nim devel.
Add tests for oneIndex(), oneValue().
2019-06-04 19:51:35 +03:00
cheatfate 1763c9dcff
Add AsyncStreams.
Add Chunked-Encoding AsyncStream reader/writer.
Add tests.
2019-05-07 23:11:40 +03:00
cheatfate 2c2e2f7fad
Add getInterfaces() and getBestRoute().
Add IpNet and IpMask.
Add TTL setting for UDP transports with {Broadcast}.
Fix comments.
Add tests.
Bump version to 2.2.5.
2019-04-15 04:27:12 +03:00
cheatfate 6a1f7785a0
Custom tracking mechanism.
1. Add simple tracking of Datagram and Stream transports.
2. Fix leaks in tests.
3. Add leaks tests to Datagram and Stream transport tests.
2019-04-04 12:34:23 +03:00
cheatfate 7d63a1b54d
Fix wait() to allow Future[void]. 2019-03-28 00:56:17 +02:00
cheatfate 3d87707b07
Fix #21. 2019-03-26 14:29:35 +02:00
Zahary Karadjov 9d346412eb All async errors are recoverable 2019-03-26 12:29:45 +02:00
cheatfate 1357045cfa
Add old version of deprecated procedures. 2019-03-24 20:59:51 +02:00
Eugene Kabanov 67e214c5df Introduce monotonic timer functions. (#24)
* Introduce monotonic timer functions.
Old fast timers are available through compiler switch.
Add tests for both timers.
* Bump version to 2.2.2.
2019-03-24 10:57:36 -06:00
Ștefan Talpalaru 685665ad21
assert() -> doAssert() 2019-03-14 04:03:32 +01:00
Mamy Ratsimbazafy 9f15c6b752
Rebrand Asyncdispatch2 to Chronos [WIP] (#20)
* Update file headers, copyright date

* Rename files and hopefully fix nimble

* Forgot to change path in tests

* Update readme
2019-02-06 15:49:11 +01:00