Commit eb0d6f2
authored
req-resp: Fix panic on connection closed for substream open failure (#291)
When a new connection is reported to the request-response protocol, the
protocol tracks the state of the connection if and only if it could open
a substream with the remote peer.
We do not track the state of the connection in cases where the substream
cannot be opened because the connection is closed.
A further `ConnectionClosed` event triggered a debug_assert assumption
for this case. The assumption is wrong since opening substreams can fail
which informs us that the connection is closed.
Connection details not tracked:
https://github.com/paritytech/litep2p/blob/eed0f755d591eb49e1b715a78aceb5a653ddf529/src/protocol/request_response/mod.rs#L267-L284
Which later leads to panics:
https://github.com/paritytech/litep2p/blob/d6fae559fbe2aaf8cb3fff021fb5608ca7b43766/src/protocol/request_response/mod.rs#L295-L301
Related to: #290
---------
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>1 parent d6fae55 commit eb0d6f2
2 files changed
+1
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
296 | 296 | | |
297 | 297 | | |
298 | 298 | | |
299 | | - | |
| 299 | + | |
300 | 300 | | |
301 | | - | |
302 | 301 | | |
303 | 302 | | |
304 | 303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | | - | |
96 | 95 | | |
97 | 96 | | |
98 | 97 | | |
| |||
0 commit comments