mirror of
https://github.com/netbirdio/netbird.git
synced 2024-11-29 11:33:48 +01:00
Add nil value check
This commit is contained in:
parent
2a3262f5a8
commit
9ccc6c6547
@ -333,10 +333,11 @@ func (conn *Conn) iCEConnectionIsReady(priority ConnPriority, iceConnInfo ICECon
|
||||
ep = wgProxy.EndpointAddr()
|
||||
conn.wgProxyICE = wgProxy
|
||||
} else {
|
||||
log.Infof("direct iceConnInfo: %v", iceConnInfo.RemoteConn)
|
||||
conn.log.Infof("direct iceConnInfo: %v", iceConnInfo.RemoteConn)
|
||||
nilCheck(conn.log, iceConnInfo.RemoteConn)
|
||||
directEp, err := net.ResolveUDPAddr("udp", iceConnInfo.RemoteConn.RemoteAddr().String())
|
||||
if err != nil {
|
||||
log.Errorf("failed to resolveUDPaddr")
|
||||
conn.log.Errorf("failed to resolveUDPaddr")
|
||||
conn.handleConfigurationFailure(err, nil)
|
||||
return
|
||||
}
|
||||
|
23
client/internal/peer/nilcheck.go
Normal file
23
client/internal/peer/nilcheck.go
Normal file
@ -0,0 +1,23 @@
|
||||
package peer
|
||||
|
||||
import (
|
||||
"net"
|
||||
"reflect"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
func nilCheck(log *log.Entry, conn net.Conn) {
|
||||
if conn == nil {
|
||||
log.Infof("conn is nil")
|
||||
return
|
||||
}
|
||||
|
||||
if conn.RemoteAddr() == nil {
|
||||
log.Infof("conn.RemoteAddr() is nil")
|
||||
}
|
||||
|
||||
if reflect.ValueOf(conn.RemoteAddr()).IsNil() {
|
||||
log.Infof("value of conn.RemoteAddr() is nil")
|
||||
}
|
||||
}
|
@ -128,6 +128,7 @@ func (w *WorkerICE) OnNewOffer(remoteOfferAnswer *OfferAnswer) {
|
||||
}
|
||||
w.log.Infof("check remoteConn: %v", remoteConn)
|
||||
w.log.Infof("check remoteConn.RemoteAddr: %v", remoteConn.RemoteAddr())
|
||||
nilCheck(w.log, remoteConn)
|
||||
w.log.Debugf("agent dial succeeded")
|
||||
|
||||
pair, err := w.agent.GetSelectedCandidatePair()
|
||||
|
Loading…
Reference in New Issue
Block a user