Skip to content

Commit 4ffae47

Browse files
committed
Merge branch 'master' of github.com:ScorexFoundation/Scorex into merge
2 parents c8645af + 6de0d64 commit 4ffae47

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

examples/src/main/resources/settings.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ scorex {
1010
network {
1111
nodeName = "generatorNode1"
1212
bindAddress = "127.0.0.1:9084"
13-
knownPeers = ["127.0.0.2:9088"]
13+
knownPeers = []
1414
agentName = "2-Hop"
1515
}
1616

src/main/resources/reference.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ scorex {
8686
# upnp-discover-timeout = 3s
8787

8888
# Network handshake timeout
89-
handshakeTimeout = 2s
89+
handshakeTimeout = 30s
9090

9191
# Network delivery timeout
9292
deliveryTimeout = 2s

src/main/scala/scorex/core/network/PeerConnectionHandler.scala

+1
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ class PeerConnectionHandler(val settings: NetworkSettings,
134134

135135
private def handshakeTimeout: Receive = {
136136
case HandshakeTimeout =>
137+
log.info(s"Handshake timeout with $remote, going to drop the connection")
137138
self ! CloseConnection
138139
}
139140

src/main/scala/scorex/core/network/peer/PeerManager.scala

+5-3
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,13 @@ class PeerManager(settings: ScorexSettings, timeProvider: NetworkTimeProvider) e
106106
val isIncoming = direction == Incoming
107107
val isAlreadyConnecting = connectingPeers.contains(remote)
108108
if (isAlreadyConnecting && !isIncoming) {
109-
log.info(s"Already connected peer $remote trying to connect, going to drop the duplicate connection")
109+
log.info(s"Trying to connect twice to $remote, going to drop the duplicate connection")
110110
peerHandlerRef ! CloseConnection
111111
} else {
112-
if (!isIncoming) log.info(s"Connecting to $remote")
112+
if (!isIncoming) {
113+
log.info(s"Connecting to $remote")
114+
connectingPeers += remote
115+
}
113116
peerHandlerRef ! StartInteraction
114117
lastIdUsed += 1
115118
}
@@ -148,7 +151,6 @@ class PeerManager(settings: ScorexSettings, timeProvider: NetworkTimeProvider) e
148151
//todo: avoid picking too many peers from the same bucket, see Bitcoin ref. impl.
149152
if (!connectedPeers.exists(_._1 == address) &&
150153
!connectingPeers.exists(_.getHostName == address.getHostName)) {
151-
connectingPeers += address
152154
sender() ! ConnectTo(address)
153155
}
154156
}

0 commit comments

Comments
 (0)