Confusing PING tutorial
Description
The ping example is confusing.
Running the example will print 2 ping events and silently close the connection:
Dialed /ip4/127.0.0.1/tcp/38703
Listening on "/ip4/127.0.0.1/tcp/34425"
Event { peer: PeerId("12D3KooWH7hh4pun3YE3fWK3XF1PgVd1x3VX9pVWLR3RM1TGLXD9"), connection: ConnectionId(1), result: Ok(87.381113ms) }
Event { peer: PeerId("12D3KooWH7hh4pun3YE3fWK3XF1PgVd1x3VX9pVWLR3RM1TGLXD9"), connection: ConnectionId(1), result: Ok(43.618339ms) }
The expectation set is that the nodes will start "pinging each other every 15 seconds". So I kept wondering if my setup was broken or what...
After modifying the example, I noticed that, what happens is:
ConnectionId ConnectionId(1) closed cause KeepAliveTimeout
So, the connection is closed after 30 seconds regardless of the ping activity.
I propose increasing the timeout to 300 seconds and adding the connection termination reason.
Motivation
the tutorial is confusing, it is difficult to asses if the sample code works or not.
Current Implementation
only to pings and sent, and then the example freezes.
Are you planning to do it yourself in a pull request ?
Yes
ok, looks like this was already fixed.
I see now, it is fixed in the example file but not in the tutorial code, which is what I followed.
With #5176 merged, can we close this issue now?
sorry yes.