174 Commits

Author SHA1 Message Date
Kevin Mai-Husan Chia
2ed12aad9f fix atomics issue
Thanks to the solution from @themighty1 to https://github.com/tlsnotary/tlsn-extension/issues/6
2023-09-07 22:43:35 +08:00
Naja Melan
4035d46573 Changelog and version number. 2023-01-29 18:47:53 +01:00
Naja Melan
343c22a24a Update github actions. 2023-01-29 18:39:11 +01:00
Naja Melan
327ae0a6f2 Merge pull request #9 from hamchapman/hc/closure-drop-on-future-cancel-fix
Fix a bug where the `onerror` callback could try to be called when it had already been destroyed
2023-01-29 17:37:42 +00:00
Naja Melan
0ea86990e4 Clippy warnings. 2023-01-29 18:18:30 +01:00
Naja Melan
fae6529b51 On future drop while connecting, close ws and log warning. 2023-01-29 18:11:36 +01:00
Hamilton Chapman
ee876f8544 Fix a bug where the onerror callback could try to be called when it had
already been destroyed.

If there was an error establishing a WebSocket connection at an `await` point
and after the point at which the `onerror` etc callbacks had been set but before
the `WsStream` had been constructed then the `onerror` callback would try to be
called but it would have already been destroyed because of the future being
cancelled.

This could happen if, for example, the initial attempt to connect to a WebSocket
server timed out and we never observed an event at this `await` point:

```rust
let mut evts = pharos.observe( Self::OPEN_CLOSE.into() ).await
```

To fix this we introduce a guard that is only active across the `await` points
in the `WsMeta::connect` function. It is temporarily responsible for
unregistering the callbacks in the case that the future is cancelled before the
`WsStream` is constructed.

The error that you'd otherwise run into would present itself like this in the
logs:

```
ERROR: Error: closure invoked recursively or destroyed already
    at imports.wbg.__wbindgen_throw (http://localhost:61367/package/web/ditto.es6.js:1:70261)
    at wasm_bindgen::throw_str::hf6afd94675c6db0f (http://localhost:61367/package/web/ditto.wasm:wasm-function[119306]:0x3327743)
    at <dyn core::ops::function::FnMut<()>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h2944e7516b507b14 (http://localhost:61367/package/web/ditto.wasm:wasm-function[49343]:0x2c601d8)
    at __wbg_adapter_36 (http://localhost:61367/package/web/ditto.es6.js:1:12851)
    at WebSocket.real (http://localhost:61367/package/web/ditto.es6.js:1:11649)
```

Co-Authored-By: Daniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>
2023-01-13 13:52:46 +00:00
Naja Melan
029a0cd2a9 Use cargo deny github action. 2022-10-29 16:06:10 +02:00
Naja Melan
abc475db55 Update send_wrapper. 2022-10-29 14:10:35 +02:00
Naja Melan
73532940f8 Add liberapay tag. 2022-10-29 14:05:51 +02:00
Naja Melan
70f2528499 Update tokio-util. 2022-10-29 14:05:36 +02:00
Naja Melan
748127db46 update todo 2021-06-28 21:02:48 +02:00
Naja Melan
d9a09165f6 Make WsStream Sync. 2021-06-28 20:53:32 +02:00
Naja Melan
b181a85c07 Rename master branch to release 2021-06-26 17:37:42 +02:00
Naja Melan
4365f0b18c Bump version and changelog. 2021-06-26 17:23:43 +02:00
Naja Melan
ff3d102fcf Add a test for Send-ness of WsStream and WsMeta. 2021-06-26 17:18:02 +02:00
Naja Melan
3f304ed214 Fix some documentation warnings. 2021-06-26 17:05:57 +02:00
Naja Melan
8cb57e4dc6 Make sure WsStream is Send. 2021-06-26 16:59:42 +02:00
Naja Melan
c4e9d91f15 Bump version and changelog. 2021-06-11 18:03:32 +02:00
Naja Melan
2ea561340d fix clippy warnings. 2021-06-11 17:55:50 +02:00
Naja Melan
6d30f495ae Switch to asynchronous_codec. 2021-06-11 17:50:40 +02:00
Naja Melan
4d7f2e0fc5 Fix external_doc for rustdoc 1.54. 2021-06-11 16:57:14 +02:00
Naja Melan
8addbfb1d9 Clean up one test. 2021-05-22 06:25:55 +02:00
Naja Melan
48bb7f00c4 Fix build status badge in readme. 2021-05-22 06:13:26 +02:00
Naja Melan
2506bc507b Migrate to github CI. 2021-02-18 12:27:25 +01:00
Naja Melan
3d7348658c Update pharos to 0.5
Fixes an issue discovered by clippy where we kept a refcell open across an await point.
2021-02-18 11:38:34 +01:00
Naja Melan
a9295ff074 Browser change, no longer throw for forbidden port. 2021-02-11 15:36:34 +01:00
Naja Melan
dd8726dd6d improve contribution guidelines. 2020-12-02 16:47:07 +01:00
Cecile Tonglet
c5dfc76c20 Fix small error in the README.md. (#3)
* Fix small error in the README.md.
2020-11-17 18:21:42 +00:00
Naja Melan
91c7044cb8 Even without cache it seems to be there. 2020-11-03 11:54:01 +01:00
Naja Melan
31c18ec93a Remove wasm-pack from the cache in CI. 2020-11-03 11:29:48 +01:00
Naja Melan
b8c065bb1e Don't publish code with local path deps... 2020-11-03 11:11:25 +01:00
Naja Melan
989ca1d478 Actually run cargo deny in CI. 2020-11-03 11:03:10 +01:00
Naja Melan
65554912cb Fix clippy warnings. 2020-11-03 11:02:04 +01:00
Naja Melan
00abd88939 Version bump and changelog. 2020-11-03 10:58:22 +01:00
Naja Melan
7fa7aa80b6 Work around futures-codec not using latest Bytes version. 2020-11-03 10:56:35 +01:00
Naja Melan
c1e6595e5e Update cargo-deny, 2020-11-03 10:55:57 +01:00
Naja Melan
58c2027a12 Update dependencies (tokio 0.3) 2020-11-03 10:55:37 +01:00
Naja Melan
1629649625 Prep release 0.6.1 2020-10-02 17:08:07 +02:00
Naja Melan
4e6ce2485f remove unneeded muts. 2020-06-24 19:04:09 +02:00
Naja Melan
35085b73ff add deny.toml and improve travis configuration. 2020-06-24 19:03:37 +02:00
Naja Melan
8d7a04ebe5 add more instructions to Cargo.yml 2020-06-24 19:03:19 +02:00
Naja Melan
0b9d280f66 Improve readme 2020-06-24 19:03:00 +02:00
Naja Melan
d1c9301f54 fix: to many categories. 2020-03-21 20:39:43 +01:00
Naja Melan
9b544f90ec chore: update changelog. 2020-03-21 19:41:41 +01:00
Naja Melan
3bad09e16c chore: remove debug and trace logs. 2020-03-21 19:26:53 +01:00
Naja Melan
3fd0feea7c chore: fix clippy warnings. 2020-03-21 19:19:20 +01:00
Naja Melan
7253187af8 give up on windows CI again 2020-03-20 19:07:51 +01:00
Naja Melan
b920101d96 try windows tests on CI. 2020-03-18 22:40:37 +01:00
Naja Melan
22043f3c5e General cleanup 2020-03-18 21:54:55 +01:00