mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-02-24 15:02:17 +01:00
Remove expectTimeout Await.result() (#4957)
This commit is contained in:
parent
4e4c6d03f1
commit
dfe92d2ba4
1 changed files with 9 additions and 5 deletions
|
@ -9,8 +9,7 @@ import org.bitcoins.node.networking.P2PClient
|
||||||
import org.bitcoins.node.networking.peer.PeerMessageReceiverState._
|
import org.bitcoins.node.networking.peer.PeerMessageReceiverState._
|
||||||
import org.bitcoins.node.{Node, P2PLogger}
|
import org.bitcoins.node.{Node, P2PLogger}
|
||||||
|
|
||||||
import scala.concurrent.duration.DurationInt
|
import scala.concurrent.Future
|
||||||
import scala.concurrent.{Await, Future}
|
|
||||||
|
|
||||||
/** Responsible for receiving messages from a peer on the
|
/** Responsible for receiving messages from a peer on the
|
||||||
* p2p network. This is called by [[org.bitcoins.rpc.client.common.Client Client]] when doing the p2p
|
* p2p network. This is called by [[org.bitcoins.rpc.client.common.Client Client]] when doing the p2p
|
||||||
|
@ -305,9 +304,14 @@ class PeerMessageReceiver(
|
||||||
case good: Normal =>
|
case good: Normal =>
|
||||||
logger.debug(s"Handling expected response for ${msg.commandName}")
|
logger.debug(s"Handling expected response for ${msg.commandName}")
|
||||||
val expectedResponseCancellable =
|
val expectedResponseCancellable =
|
||||||
system.scheduler.scheduleOnce(nodeAppConfig.queryWaitTime)(
|
system.scheduler.scheduleOnce(nodeAppConfig.queryWaitTime) {
|
||||||
Await.result(node.peerManager.sendResponseTimeout(peer, msg),
|
val responseTimeoutF =
|
||||||
10.seconds))
|
node.peerManager.sendResponseTimeout(peer, msg)
|
||||||
|
responseTimeoutF.failed.foreach(err =>
|
||||||
|
logger.error(
|
||||||
|
s"Failed to timeout waiting for response for peer=$peer",
|
||||||
|
err))
|
||||||
|
}
|
||||||
val newState = Waiting(
|
val newState = Waiting(
|
||||||
clientConnectP = good.clientConnectP,
|
clientConnectP = good.clientConnectP,
|
||||||
clientDisconnectP = good.clientDisconnectP,
|
clientDisconnectP = good.clientDisconnectP,
|
||||||
|
|
Loading…
Add table
Reference in a new issue