Skip to content

Commit 130c41a

Browse files
authored
fix: Locking issue after #190 (#191)
#190 removed the read timeouts of the `Peer::receive_message` which currently leads to a lockup of the peer because the write lock is held while waiting for the message. Needs some more refactoring but this works for now.
1 parent b6b4181 commit 130c41a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

dash-spv/src/network/manager.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ impl PeerNetworkManager {
331331
message = peer_guard.receive_message() => {
332332
message
333333
},
334+
_ = tokio::time::sleep(MESSAGE_RECEIVE_TIMEOUT) => {
335+
Err(NetworkError::Timeout)
336+
},
334337
_ = shutdown_token.cancelled() => {
335338
log::info!("Breaking peer reader loop for {} - shutdown signal received while reading (iteration {})", addr, loop_iteration);
336339
break;

0 commit comments

Comments
 (0)