lnd: add new "perm" bit to the ConnectPeer RPC call

This commit modifies the ConnectPeer RPC call and partitions the
behavior of the call into two scenarios: the connection should be
persistent which causes the call to be non-blocking, and the connection
should only attempt to connect once — which causes the call to be
blocking and report any error back to the caller.

As a result, the pendingConnRequest map and the logic around it is no
longer needed.
This commit is contained in:
Olaoluwa Osuntokun committed 2017-01-09 19:09:03 -08:00
1 parent b01e7efcef
commit 8cdb84c619
3 files changed
+42 -59

No files matched your search

+2 -4
View File
@@ -215,15 +215,13 @@ func (r *rpcServer) ConnectPeer(ctx context.Context,
ChainNet: activeNetParams.Net,
}
peerID, err := r.server.ConnectToPeer(peerAddr)
if err != nil {
if err := r.server.ConnectToPeer(peerAddr, in.Perm); err != nil {
rpcsLog.Errorf("(connectpeer): error connecting to peer: %v", err)
return nil, err
}
// TODO(roasbeef): add pubkey return
rpcsLog.Debugf("Connected to peer: %v", peerAddr.String())
return &lnrpc.ConnectPeerResponse{peerID}, nil
return &lnrpc.ConnectPeerResponse{}, nil
}
// OpenChannel attempts to open a singly funded channel specified in the