mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-06-16 02:56:39 +00:00
[NOD-952] Fix nil derefernce bug on outboundPeerConnectionFailed (#704)
This commit is contained in:
parent
2910724b49
commit
3c89e1f7b3
@ -16,8 +16,7 @@ type Cursor interface {
|
|||||||
Seek(key *Key) error
|
Seek(key *Key) error
|
||||||
|
|
||||||
// Key returns the key of the current key/value pair, or ErrNotFound if done.
|
// Key returns the key of the current key/value pair, or ErrNotFound if done.
|
||||||
// Note that the key is trimmed to not include the prefix the cursor was opened
|
// The caller should not modify the contents of the returned key, and
|
||||||
// with. The caller should not modify the contents of the returned slice, and
|
|
||||||
// its contents may change on the next call to Next.
|
// its contents may change on the next call to Next.
|
||||||
Key() (*Key, error)
|
Key() (*Key, error)
|
||||||
|
|
||||||
|
@ -1047,6 +1047,12 @@ func (s *Server) outboundPeerConnected(state *peerState, msg *outboundPeerConnec
|
|||||||
// outboundPeerConnected is invoked by the connection manager when a new
|
// outboundPeerConnected is invoked by the connection manager when a new
|
||||||
// outbound connection failed to be established.
|
// outbound connection failed to be established.
|
||||||
func (s *Server) outboundPeerConnectionFailed(msg *outboundPeerConnectionFailedMsg) {
|
func (s *Server) outboundPeerConnectionFailed(msg *outboundPeerConnectionFailedMsg) {
|
||||||
|
// If the connection request has no address
|
||||||
|
// associated to it, do nothing.
|
||||||
|
if msg.connReq.Addr == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
host, portStr, err := net.SplitHostPort(msg.connReq.Addr.String())
|
host, portStr, err := net.SplitHostPort(msg.connReq.Addr.String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
srvrLog.Debugf("Cannot extract address host and port %s: %s", msg.connReq.Addr, err)
|
srvrLog.Debugf("Cannot extract address host and port %s: %s", msg.connReq.Addr, err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user