Skip to content

Commit

Permalink
Merge f7002cf into 782fd9d
Browse files Browse the repository at this point in the history
  • Loading branch information
wpaulino committed Jun 6, 2018
2 parents 782fd9d + f7002cf commit df1681f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion rpcserver.go
Expand Up @@ -1292,7 +1292,7 @@ func (r *rpcServer) ListPeers(ctx context.Context,
peer := &lnrpc.Peer{
PubKey: hex.EncodeToString(nodePub),
Address: serverPeer.conn.RemoteAddr().String(),
Inbound: !serverPeer.inbound, // Flip for display
Inbound: serverPeer.inbound,
BytesRecv: atomic.LoadUint64(&serverPeer.bytesReceived),
BytesSent: atomic.LoadUint64(&serverPeer.bytesSent),
SatSent: satSent,
Expand Down
11 changes: 6 additions & 5 deletions server.go
Expand Up @@ -1537,7 +1537,8 @@ func (s *server) shouldRequestGraphSync() bool {

// peerConnected is a function that handles initialization a newly connected
// peer by adding it to the server's global list of all active peers, and
// starting all the goroutines the peer needs to function properly.
// starting all the goroutines the peer needs to function properly. The inbound
// boolean should be true if the peer initiated the connection to us.
func (s *server) peerConnected(conn net.Conn, connReq *connmgr.ConnReq,
inbound bool) {

Expand Down Expand Up @@ -1672,7 +1673,7 @@ func (s *server) InboundPeerConnected(conn net.Conn) {
case ErrPeerNotConnected:
// We were unable to locate an existing connection with the
// target peer, proceed to connect.
s.peerConnected(conn, nil, false)
s.peerConnected(conn, nil, true)

case nil:
// We already have a connection with the incoming peer. If the
Expand All @@ -1699,7 +1700,7 @@ func (s *server) InboundPeerConnected(conn net.Conn) {
s.removePeer(connectedPeer)
s.ignorePeerTermination[connectedPeer] = struct{}{}
s.scheduledPeerConnection[pubStr] = func() {
s.peerConnected(conn, nil, false)
s.peerConnected(conn, nil, true)
}
}
}
Expand Down Expand Up @@ -1769,7 +1770,7 @@ func (s *server) OutboundPeerConnected(connReq *connmgr.ConnReq, conn net.Conn)
case ErrPeerNotConnected:
// We were unable to locate an existing connection with the
// target peer, proceed to connect.
s.peerConnected(conn, connReq, true)
s.peerConnected(conn, connReq, false)

case nil:
// We already have a connection open with the target peer.
Expand Down Expand Up @@ -1800,7 +1801,7 @@ func (s *server) OutboundPeerConnected(connReq *connmgr.ConnReq, conn net.Conn)
s.removePeer(connectedPeer)
s.ignorePeerTermination[connectedPeer] = struct{}{}
s.scheduledPeerConnection[pubStr] = func() {
s.peerConnected(conn, connReq, true)
s.peerConnected(conn, connReq, false)
}
}
}
Expand Down

0 comments on commit df1681f

Please sign in to comment.