@@ -104,7 +104,7 @@ class RLPxConnectionHandler(
104
104
105
105
case Failure (ex) =>
106
106
log.debug(
107
- s " [Stopping Connection] Init AuthHandshaker message handling failed for peer {} due to {} " ,
107
+ " [Stopping Connection] Init AuthHandshaker message handling failed for peer {} due to {}" ,
108
108
peerId,
109
109
ex.getMessage
110
110
)
@@ -132,7 +132,7 @@ class RLPxConnectionHandler(
132
132
133
133
case Failure (ex) =>
134
134
log.debug(
135
- s " [Stopping Connection] Response AuthHandshaker message handling failed for peer {} due to {} " ,
135
+ " [Stopping Connection] Response AuthHandshaker message handling failed for peer {} due to {}" ,
136
136
peerId,
137
137
ex.getMessage
138
138
)
@@ -154,25 +154,25 @@ class RLPxConnectionHandler(
154
154
}
155
155
156
156
def handleTimeout : Receive = { case AuthHandshakeTimeout =>
157
- log.debug(s " [Stopping Connection] Auth handshake timeout for peer {} " , peerId)
157
+ log.debug(" [Stopping Connection] Auth handshake timeout for peer {}" , peerId)
158
158
context.parent ! ConnectionFailed
159
159
context stop self
160
160
}
161
161
162
162
def processHandshakeResult (result : AuthHandshakeResult , remainingData : ByteString ): Unit =
163
163
result match {
164
164
case AuthHandshakeSuccess (secrets, remotePubKey) =>
165
- log.debug(s " Auth handshake succeeded for peer {} " , peerId)
165
+ log.debug(" Auth handshake succeeded for peer {}" , peerId)
166
166
context.parent ! ConnectionEstablished (remotePubKey)
167
167
// following the specification at https://github.com/ethereum/devp2p/blob/master/rlpx.md#initial-handshake
168
168
// point 6 indicates that the next messages needs to be initial 'Hello'
169
169
// Unfortunately it is hard to figure out the proper order for messages to be handled in.
170
170
// FrameCodec assumes that bytes will arrive in the expected order
171
171
// To alleviate potential lapses in order each chunk of data needs to be passed to FrameCodec immediately
172
- extractHello(extractor(secrets), remainingData, None , 0 )
172
+ extractHello(extractor(secrets), remainingData)
173
173
174
174
case AuthHandshakeError =>
175
- log.debug(s " [Stopping Connection] Auth handshake failed for peer {} " , peerId)
175
+ log.debug(" [Stopping Connection] Auth handshake failed for peer {}" , peerId)
176
176
context.parent ! ConnectionFailed
177
177
context stop self
178
178
}
@@ -201,7 +201,7 @@ class RLPxConnectionHandler(
201
201
202
202
case AckTimeout (ackSeqNumber) if cancellableAckTimeout.exists(_.seqNumber == ackSeqNumber) =>
203
203
cancellableAckTimeout.foreach(_.cancellable.cancel())
204
- log.error(s " [Stopping Connection] Sending 'Hello' to {} failed " , peerId)
204
+ log.error(" [Stopping Connection] Sending 'Hello' to {} failed" , peerId)
205
205
context stop self
206
206
case Received (data) =>
207
207
extractHello(extractor, data, cancellableAckTimeout, seqNumber)
@@ -210,8 +210,8 @@ class RLPxConnectionHandler(
210
210
private def extractHello (
211
211
extractor : HelloCodec ,
212
212
data : ByteString ,
213
- cancellableAckTimeout : Option [CancellableAckTimeout ],
214
- seqNumber : Int
213
+ cancellableAckTimeout : Option [CancellableAckTimeout ] = None ,
214
+ seqNumber : Int = 0
215
215
): Unit = {
216
216
extractor.readHello(data) match {
217
217
case Some ((hello, restFrames)) =>
@@ -229,12 +229,12 @@ class RLPxConnectionHandler(
229
229
seqNumber = seqNumber
230
230
)
231
231
case None =>
232
- log.debug(s " [Stopping Connection] Unable to negotiate protocol with {} " , peerId)
232
+ log.debug(" [Stopping Connection] Unable to negotiate protocol with {}" , peerId)
233
233
context.parent ! ConnectionFailed
234
234
context stop self
235
235
}
236
236
case None =>
237
- log.debug(s " [Stopping Connection] Did not find 'Hello' in message from {} " , peerId)
237
+ log.debug(" [Stopping Connection] Did not find 'Hello' in message from {}" , peerId)
238
238
context become awaitInitialHello(extractor, cancellableAckTimeout, seqNumber)
239
239
}
240
240
}
@@ -255,7 +255,7 @@ class RLPxConnectionHandler(
255
255
context.parent ! MessageReceived (message)
256
256
257
257
case Failure (ex) =>
258
- log.info(s " Cannot decode message from {}, because of {} " , peerId, ex.getMessage)
258
+ log.info(" Cannot decode message from {}, because of {}" , peerId, ex.getMessage)
259
259
// break connection in case of failed decoding, to avoid attack which would send us garbage
260
260
context stop self
261
261
}
@@ -303,7 +303,7 @@ class RLPxConnectionHandler(
303
303
304
304
case AckTimeout (ackSeqNumber) if cancellableAckTimeout.exists(_.seqNumber == ackSeqNumber) =>
305
305
cancellableAckTimeout.foreach(_.cancellable.cancel())
306
- log.debug(s " [Stopping Connection] Write to {} failed " , peerId)
306
+ log.debug(" [Stopping Connection] Write to {} failed" , peerId)
307
307
context stop self
308
308
}
309
309
}
@@ -325,7 +325,7 @@ class RLPxConnectionHandler(
325
325
): Unit = {
326
326
val out = messageCodec.encodeMessage(messageToSend)
327
327
connection ! Write (out, Ack )
328
- log.debug(s " Sent message: {} to {} " , messageToSend.underlyingMsg.toShortString, peerId)
328
+ log.debug(" Sent message: {} to {}" , messageToSend.underlyingMsg.toShortString, peerId)
329
329
330
330
val timeout = system.scheduler.scheduleOnce(rlpxConfiguration.waitForTcpAckTimeout, self, AckTimeout (seqNumber))
331
331
context become handshaked(
@@ -349,7 +349,7 @@ class RLPxConnectionHandler(
349
349
350
350
def handleWriteFailed : Receive = { case CommandFailed (cmd : Write ) =>
351
351
log.debug(
352
- s " [Stopping Connection] Write to peer {} failed, trying to send {} " ,
352
+ " [Stopping Connection] Write to peer {} failed, trying to send {}" ,
353
353
peerId,
354
354
Hex .toHexString(cmd.data.toArray[Byte ])
355
355
)
@@ -358,10 +358,10 @@ class RLPxConnectionHandler(
358
358
359
359
def handleConnectionClosed : Receive = { case msg : ConnectionClosed =>
360
360
if (msg.isPeerClosed) {
361
- log.debug(s " [Stopping Connection] Connection with {} closed by peer " , peerId)
361
+ log.debug(" [Stopping Connection] Connection with {} closed by peer" , peerId)
362
362
}
363
363
if (msg.isErrorClosed) {
364
- log.debug(s " [Stopping Connection] Connection with {} closed because of error {} " , peerId, msg.getErrorCause)
364
+ log.debug(" [Stopping Connection] Connection with {} closed because of error {}" , peerId, msg.getErrorCause)
365
365
}
366
366
367
367
context stop self
0 commit comments