cardano-diffusion:ping - rtt output
Round handshake and chain sync rtt to milliseconds (as we do for keep alive rtts).
Round handshake and chain sync rtt to milliseconds (as we do for keep alive rtts).
Changed the format to log one JSON encoded message per line. When we logged a list of messages as JSON output, they get interleaved with other messages, making the output not a valid JSON unless quiet mode was used.
Have each peer step its own TVar counter and aggregate them in the txCountersThreadV2 thread when they are emitted. Multi-peer benchmarks shows between -9% and -22% in wall-clock and -13% allocation.
Removed `onException`, since the socket is already closed using
a bracket.
In `CloseOnRead` case ignore `Shutdown {}` - as in other cases. This
should fix:
```
mux close (IO): FAIL (0.08s)
*** Failed! Falsified (after 8 tests):
CloseOnRead
[]
<function>
-10
Right (Shutdown (Just (IOException withIODataPtr (recvBuf): invalid argument (An existing connection was forcibly closed by the remote host.) "recv errored")) (Failed (IOException withIODataPtr (recvBuf): invalid argument (An existing connection was forcibly closed by the remote host.) "recv errored")))
```
The tests started to fail due to usage of version data codec which doesn't satisfy round robin property on invalid version data in the previous commit.
We used to need to call `cborTermVersionDataCodec` to get `VersionDataCodec` from `CodecCBORTerm`. The `VersionDataCodec` and `cborTermVersionDataCodec` is moved to `ouroboros-network:api` library (`Ouroboros.network.CodecCBORTerm` module). `cardano-diffusion` provides both `nodeToNodeVersionDataCodec` and `nodeToClientVersionDataCodec`. This required a refactorisation in tests to get rid of some newtype wrappers, however the semantics of all the tests is preserved.
Exposed `nodeTo{Node,Client}VersionDataCodec` instead.
Ping runs in either of the two modes query tip of ping, so a sum type is better than a product of two boolean values.
Shorten the timeout to 1 second. Moved the delay from each client to the main thread. This way the output is written quicker to stdout.
Removed `onException`, since the socket is already closed using
a bracket.
In `CloseOnRead` case ignore `Shutdown {}` - as in other cases. This
should fix:
```
mux close (IO): FAIL (0.08s)
*** Failed! Falsified (after 8 tests):
CloseOnRead
[]
<function>
-10
Right (Shutdown (Just (IOException withIODataPtr (recvBuf): invalid argument (An existing connection was forcibly closed by the remote host.) "recv errored")) (Failed (IOException withIODataPtr (recvBuf): invalid argument (An existing connection was forcibly closed by the remote host.) "recv errored")))
```
Exposed `nodeTo{Node,Client}VersionDataCodec` instead.
The tests started to fail due to usage of version data codec which doesn't satisfy round robin property on invalid version data in the previous commit.
We used to need to call `cborTermVersionDataCodec` to get `VersionDataCodec` from `CodecCBORTerm`. The `VersionDataCodec` and `cborTermVersionDataCodec` is moved to `ouroboros-network:api` library (`Ouroboros.network.CodecCBORTerm` module). `cardano-diffusion` provides both `nodeToNodeVersionDataCodec` and `nodeToClientVersionDataCodec`. This required a refactorisation in tests to get rid of some newtype wrappers, however the semantics of all the tests is preserved.
Shorten the timeout to 1 second. Moved the delay from each client to the main thread. This way the output is written quicker to stdout.
Ping runs in either of the two modes query tip of ping, so a sum type is better than a product of two boolean values.