mirror of
https://github.com/tailscale/tailscale.git
synced 2024-12-04 15:35:38 +00:00
ipn: allow b to be nil in NewBackendServer
A couple of code paths in ipnserver use a NewBackendServer with a nil backend just to call the callback with an encapsulated error message. This covers a panic case seen in logs. For #1920 Signed-off-by: David Crawshaw <crawshaw@tailscale.com>
This commit is contained in:
parent
f22185cae1
commit
256db54c9d
@ -104,7 +104,9 @@ func NewBackendServer(logf logger.Logf, b Backend, sendNotifyMsg func(b []byte))
|
|||||||
b: b,
|
b: b,
|
||||||
sendNotifyMsg: sendNotifyMsg,
|
sendNotifyMsg: sendNotifyMsg,
|
||||||
}
|
}
|
||||||
if sendNotifyMsg != nil {
|
// b may be nil if the BackendServer is being created just to
|
||||||
|
// encapsulate and send an error message.
|
||||||
|
if sendNotifyMsg != nil && b != nil {
|
||||||
b.SetNotifyCallback(bs.send)
|
b.SetNotifyCallback(bs.send)
|
||||||
}
|
}
|
||||||
return bs
|
return bs
|
||||||
|
Loading…
Reference in New Issue
Block a user