1
0
Fork 0
mirror of https://github.com/ACINQ/eclair.git synced 2025-02-22 14:22:39 +01:00

fixup! Split the Peer in two (#1347) (#1365)

This commit is contained in:
Pierre-Marie Padiou 2020-04-02 16:07:30 +02:00 committed by GitHub
parent 0e260985e2
commit 4be5c34ad2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -87,7 +87,7 @@ class PeerConnection(nodeParams: NodeParams, switchboard: ActorRef, router: Acto
import d.pendingAuth.address
log.info(s"connection authenticated with $remoteNodeId@${address.getHostString}:${address.getPort} direction=${if (d.pendingAuth.outgoing) "outgoing" else "incoming"}")
Metrics.PeerConnectionsConnecting.withTag(Tags.ConnectionState, Tags.ConnectionStates.Authenticated).increment()
switchboard ! Authenticated(self, remoteNodeId, address, d.pendingAuth.outgoing, d.pendingAuth.origin_opt)
switchboard ! Authenticated(self, remoteNodeId)
goto(BEFORE_INIT) using BeforeInitData(remoteNodeId, d.pendingAuth, d.transport)
case Event(AuthTimeout, _) =>
@ -484,7 +484,7 @@ object PeerConnection {
case class PendingAuth(connection: ActorRef, remoteNodeId_opt: Option[PublicKey], address: InetSocketAddress, origin_opt: Option[ActorRef], transport_opt: Option[ActorRef] = None) {
def outgoing: Boolean = remoteNodeId_opt.isDefined // if this is an outgoing connection, we know the node id in advance
}
case class Authenticated(peerConnection: ActorRef, remoteNodeId: PublicKey, address: InetSocketAddress, outgoing: Boolean, origin_opt: Option[ActorRef])
case class Authenticated(peerConnection: ActorRef, remoteNodeId: PublicKey)
case class InitializeConnection(peer: ActorRef)
case class ConnectionReady(peerConnection: ActorRef, remoteNodeId: PublicKey, address: InetSocketAddress, outgoing: Boolean, localInit: wire.Init, remoteInit: wire.Init)

View file

@ -72,7 +72,7 @@ class PeerConnectionSpec extends TestkitBaseClass with StateTestsHelperMethods {
val probe = TestProbe()
probe.send(peerConnection, PeerConnection.PendingAuth(connection.ref, Some(remoteNodeId), address, origin_opt = None, transport_opt = Some(transport.ref)))
transport.send(peerConnection, TransportHandler.HandshakeCompleted(remoteNodeId))
switchboard.expectMsg(PeerConnection.Authenticated(peerConnection, remoteNodeId, address, outgoing = true, origin_opt = None))
switchboard.expectMsg(PeerConnection.Authenticated(peerConnection, remoteNodeId))
probe.send(peerConnection, PeerConnection.InitializeConnection(peer.ref))
transport.expectMsgType[TransportHandler.Listener]
val localInit = transport.expectMsgType[wire.Init]