Commit Graph

705 Commits

Author SHA1 Message Date
narimiran ca8291c8cd
use the common CI workflow 2024-11-26 12:43:58 +01:00
Etan Kissling 9186950e03
Replace `apt-fast` with `apt-get` (#558)
`apt-fast` was removed from GitHub with Ubuntu 24.04:

- https://github.com/actions/runner-images/issues/10003

For compatibility, switch back to `apt-get`.
2024-10-15 15:19:42 +00:00
Eugene Kabanov c04576d829
Bump version to 4.0.3. (#555) 2024-08-22 02:53:48 +03:00
diegomrsantos dc3847e4d6
add ubuntu 24 and gcc 14 (#553)
* add ubuntu 24 and gcc 14

* upgrade bearssl

* Fix nim-1-6 gcc-14 issue.

* rename target to linux-gcc-14

* Bump bearssl.

---------

Co-authored-by: cheatfate <eugene.kabanov@status.im>
2024-07-18 20:59:03 +03:00
c-blake 8f609b6c17
Fix tests to be string hash order independent (#551) 2024-07-09 11:42:20 +02:00
Miran 13d28a5b71
update ci.yml and be more explicit in .nimble (#549) 2024-07-03 12:57:58 +02:00
Jacek Sieka 4ad38079de
pretty-printer for `Duration` (#547) 2024-06-20 09:52:23 +02:00
Giuliano Mega 7630f39471
Fixes compilation issues in v3 compatibility mode (`-d:chronosHandleException`) (#545)
* add missing calls to await

* add test run in v3 compatibility

* fix semantics for chronosHandleException so it does not override local raises/handleException annotations

* distinguish between explicit override and default setting; fix test

* re-enable wrongly disabled check

* make implementation simpler/clearer

* update docs

* reflow long line

* word swap
2024-06-10 10:18:42 +02:00
Jacek Sieka c44406594f
fix results import 2024-06-07 12:05:15 +02:00
Eugene Kabanov 1b9d9253e8
Fix GCC-14 [-Wincompatible-pointer-types] issues. (#546)
* Fix class assignment.

* One more fix.

* Bump bearssl version.
2024-06-02 18:05:22 +03:00
Jacek Sieka 8a306763ce
docs for `join` and `noCancel` 2024-05-07 17:19:35 +02:00
Jacek Sieka 1ff81c60ea
avoid warning in noCancel with non-raising future (#540) 2024-05-06 08:56:48 +00:00
Jacek Sieka 52b02b9977
remove unnecessary impl overloads (#539) 2024-05-04 11:52:42 +02:00
Eugene Kabanov 72f560f049
Fix RangeError defect being happened using android toolchain. (#538)
* Fix RangeError defect being happened using android toolchain.

* Set proper type for `Tnfds`.

* Update comment.
2024-04-25 19:08:53 +03:00
Eugene Kabanov bb96f02ae8
Fix `wait(future)` declaration signature. (#537) 2024-04-24 03:16:23 +03:00
Eugene Kabanov 0f0ed1d654
Add wait(deadline future) implementation. (#535)
* Add waitUntil(deadline) implementation.

* Add one more test.

* Fix rare race condition and tests for it.

* Rename waitUntil() to wait().
2024-04-20 03:49:07 +03:00
Eugene Kabanov d184a92227
Fix rare cancellation race issue on timeout for wait/withTimeout. (#536)
Add tests.
2024-04-19 16:43:34 +03:00
Eugene Kabanov 7a3eaffa4f
Fix English spelling for `readed` variable. (#534) 2024-04-17 23:08:19 +00:00
Eugene Kabanov bd7d84fbcb
Fix AsyncStreamReader constructor declaration mistypes. (#533) 2024-04-17 14:41:36 +00:00
Eugene Kabanov e4cb48088c
Fix inability to change httpclient's internal buffer size. (#531)
Add test.
Address #529.
2024-04-17 17:27:14 +03:00
Eugene Kabanov 0d050d5823
Add automatic constructors for TCP and UDP transports. (#512)
* Add automatic constructors for TCP and UDP transports.

* Add port number argument.
Add some documentation comments.
Fix tests.

* Make datagram test use request/response scheme.

* Add helper.

* Fix issue with non-zero port setups.
Add test.

* Fix tests to probe ports.

* Attempt to fix MacOS issue.

* Add Opt[IpAddress].
Make IPv4 mapping to IPv6 space automatic.

* Add tests.

* Add stream capabilities.

* Fix Linux issues.

* Make getTransportFlags() available for all OSes.

* Fix one more compilation issue.

* Workaround weird compiler bug.

* Fix forgotten typed version of constructor.

* Make single source for addresses calculation.

* Add one more check into tests.

* Fix flags not being set in transport constructor.

* Fix post-rebase issues with flags not being set.

* Address review comments.
2024-04-13 03:04:42 +03:00
Eugene Kabanov 8e49df1400
Ensure that all buffers used inside HTTP client will follow original buffer size. (#530)
Ensure that buffer size cannot be lower than default size.
2024-04-07 07:03:12 +03:00
Eugene Kabanov 2d85229dce
Add `join()` operation to wait for future completion. (#525)
* Add `join()` operation to wait for future completion without cancelling it when `join()` got cancelled.

* Start using join() operation.
2024-04-04 00:30:01 +03:00
Eugene Kabanov 402914f4cf
Add custom ring buffer into chronos streams and transports. (#485)
* Add custom ring buffer into chronos stream transport.

* Rename BipBuffer.decommit() to BipBuffer.consume()
Make asyncstream's using BipBuffer.

* Address review comments part 1.

* Address review comments part 2.

* Address review comments.

* Remove unused import results.

* Address review comments.
2024-03-26 22:33:19 +02:00
Jacek Sieka ef1b077adf
v4.0.2 2024-03-25 10:38:37 +01:00
Jacek Sieka b8b4e1fc47
make `Raising` compatible with 2.0 (#526)
* make `Raising` compatible with 2.0

See https://github.com/nim-lang/Nim/issues/23432

* Update tests/testfut.nim

* Update tests/testfut.nim
2024-03-25 10:37:42 +01:00
Jacek Sieka 0e806d59ae
v4.0.1 2024-03-21 09:21:51 +01:00
Jacek Sieka d5bc90fef2
Work around type resolution with empty generic (#522)
* Work around type resolution with empty generic

* workaround
2024-03-20 12:08:26 +01:00
Eugene Kabanov 035288f3f0
Remove `sink` and `chronosMoveSink()` usage. (#524) 2024-03-20 07:47:59 +01:00
Eugene Kabanov d4f1487b0c
Disable libbacktrace enabled test on X86 platforms. (#523)
* Disable libbacktrace enabled test on X86 platforms.

* Fix mistype.

* Use macos-12 workers from now.
2024-03-19 16:28:52 +00:00
Jacek Sieka 47cc17719f
print warning when calling failed (#521)
`failed` cannot return true for futures that don't forward exceptions
2024-03-08 14:43:42 +01:00
Etan Kissling 17b7a76c7e
Ensure `transp.reader` is reset to `nil` on error (#508)
In `stream.readLoop`, a finished `Future` was left in `transp.reader`
if there was an error in `resumeRead`. Set it to `nil` as well.

Co-authored-by: Jacek Sieka <jacek@status.im>
2024-03-07 08:09:16 +01:00
Jacek Sieka c5a5ece487
fix circular reference in timer (#510) 2024-03-07 08:07:53 +01:00
Jacek Sieka 03d82475d9
Avoid `ValueError` effect in varargs `race`/`one` (#520)
We can check at compile-time that at least one parameter is passed

* clean up closure environment explicitly in some callbacks to release
memory earlier
2024-03-06 06:42:22 +01:00
Eugene Kabanov f6c7ecfa0a
Add missing parts of defaults buffer size increase. (#513) 2024-03-06 01:56:40 +02:00
Eugene Kabanov 4ed0cd6be7
Ensure that `OwnCancelSchedule` flag will not be removed from `wait()` and `withTimeout()`. (#519) 2024-03-05 17:34:53 +01:00
Eugene Kabanov 1eb834a2f9
Fix `or` deadlock issue. (#517)
* Fix `or` should not create future with OwnCancelSchedule flag set.

* Fix `CancelledError` missing from raises list when both futures has empty raises list.

* Fix macros tests.
2024-03-05 17:33:46 +01:00
Etan Kissling 5dfa3fd7fa
fix conversion error with `or` on futures with `{.async: (raises: []).}` (#515)
```nim
import chronos

proc f(): Future[void] {.async: (raises: []).} =
  discard

discard f() or f() or f()
```

```
/Users/etan/Documents/Repos/nimbus-eth2/vendor/nim-chronos/chronos/internal/raisesfutures.nim(145, 44) union
/Users/etan/Documents/Repos/nimbus-eth2/vendor/nimbus-build-system/vendor/Nim/lib/core/macros.nim(185, 28) []
/Users/etan/Documents/Repos/nimbus-eth2/test.nim(6, 13) template/generic instantiation of `or` from here
/Users/etan/Documents/Repos/nimbus-eth2/vendor/nim-chronos/chronos/internal/asyncfutures.nim(1668, 39) template/generic instantiation of `union` from here
/Users/etan/Documents/Repos/nimbus-eth2/vendor/nimbus-build-system/vendor/Nim/lib/core/macros.nim(185, 28) Error: illegal conversion from '-1' to '[0..9223372036854775807]'
```

Fix by checking for `void` before trying to access `raises`
2024-03-05 13:53:12 +01:00
Eugene Kabanov 7b02247ce7
Add `--mm:refc` to `libbacktrace` test. (#505)
* Add `--mm:refc` to `libbacktrace` test.

* Make tests with `refc` to run before tests with default memory manager.
2024-02-14 19:23:15 +02:00
Eugene Kabanov 2e37a6e26c
Increase AsyncStream and Transport default buffer size from 4096 to 16384 bytes. (#506)
Make buffer sizes configurable at compile time.
2024-02-14 19:23:01 +02:00
cheatfate be4923be19
Strip debugging echo in threadsync tests. 2024-02-14 14:09:01 +02:00
Eugene Kabanov a81961a3c6
Fix HTTP server accept() loop exiting under heavy load. (#502)
* Add more specific accept() exceptions raised.
Add some refactoring to HTTP server code.

* Refactor acceptLoop.

* Print GC statistics in every failing test.

* Try to disable failing tests.
2024-02-14 14:05:19 +02:00
Jacek Sieka 8cf2d69aaa
Minimal threading docs (#493)
* Minimal threading docs

* compile examples with threads

* links
2024-02-14 08:27:09 +01:00
Eugene Kabanov 08db79fe63
Disable memory hungry tests in 32bit tests. (#503)
* Disable memory hungry tests in 32bit tests.

* Limit threadsync tests for 32bit.
2024-02-14 00:03:12 +02:00
Jacek Sieka 672db137b7
v4.0.0 (#494)
Features:

* Exception effects / raises for async procedures helping you write more
efficient leak-free code
* Cross-thread notification mechanism for suitable building channels,
queues and other multithreaded primitives
* Async process I/O
* IPv6 dual stack support
* HTTP middleware support alloing multiple services to share a single
http server
* A new [documentation web
site](https://status-im.github.io/nim-chronos/) covering the basics,
with several simple examples for getting started
* Implicit returns, support for `results.?` and other conveniences
* Rate limiter
* Revamped cancellation support with more control over the cancellation
process
* Efficiency improvements with `lent` and `sink`

See the [porting](https://status-im.github.io/nim-chronos/porting.html)
guides for porting code from earlier chronos releases (as well as
asyncdispatch)
2024-01-24 19:33:13 +02:00
Eugene Kabanov 09a0b11719
Make asyncproc use asyncraises. (#497)
* Make asyncproc use asyncraises.

* Fix missing asyncraises for waitForExit().
2024-01-23 08:34:10 +01:00
Jacek Sieka e296ae30c8
asyncraises for threadsync (#495)
* asyncraises for threadsync

* missing bracket

* missing exception
2024-01-20 16:56:57 +01:00
Jacek Sieka 3ca2c5e6b5
deprecate `callback=`, UDP fixes (fixes #491) (#492)
Using the callback setter may lead to callbacks owned by others being
reset, which is unexpected.

* don't crash on zero-length UDP writes
2024-01-19 09:21:10 +01:00
Jacek Sieka 1021a7d294
check leaks after every test (#487) 2024-01-18 14:34:16 +02:00
cheatfate 92acf68b04
Fix examples documentation. 2024-01-12 15:39:45 +02:00