diff --git a/client/internal/peer/handshaker.go b/client/internal/peer/handshaker.go index ede870077..c5bd997f7 100644 --- a/client/internal/peer/handshaker.go +++ b/client/internal/peer/handshaker.go @@ -3,6 +3,7 @@ package peer import ( "context" "errors" + "strconv" "sync" log "github.com/sirupsen/logrus" @@ -43,6 +44,13 @@ type OfferAnswer struct { SessionID *int64 } +func (oa *OfferAnswer) SessionIDString() string { + if oa.SessionID == nil { + return "unknown" + } + return strconv.FormatInt(*oa.SessionID, 10) +} + type Handshaker struct { mu sync.Mutex log *log.Entry diff --git a/client/internal/peer/worker_ice.go b/client/internal/peer/worker_ice.go index 4bb898d51..0614c5869 100644 --- a/client/internal/peer/worker_ice.go +++ b/client/internal/peer/worker_ice.go @@ -90,7 +90,7 @@ func NewWorkerICE(ctx context.Context, log *log.Entry, config ConnConfig, conn * } func (w *WorkerICE) OnNewOffer(remoteOfferAnswer *OfferAnswer) { - w.log.Debugf("OnNewOffer for ICE, serial: %d", *remoteOfferAnswer.SessionID) + w.log.Debugf("OnNewOffer for ICE, serial: %d", remoteOfferAnswer.SessionIDString()) w.muxAgent.Lock() if w.agentConnecting { @@ -261,7 +261,7 @@ func (w *WorkerICE) connect(ctx context.Context, agent *ice.Agent, remoteOfferAn } w.log.Debugf("on ICE conn is ready to use") - w.log.Infof("connection succeeded with offer session: %d", *remoteOfferAnswer.SessionID) + w.log.Infof("connection succeeded with offer session: %d", remoteOfferAnswer.SessionIDString()) w.muxAgent.Lock() w.agentConnecting = false w.lastSuccess = time.Now()