ipn/ipnlocal: check that sockstatLogger is available in c2n endpoint

Otherwise there may be a panic if it's nil (and the control side of
the c2n call will just time out).

Signed-off-by: Mihai Parparita <mihai@tailscale.com>
shayne/funnel_cmd
Mihai Parparita 1 year ago committed by Mihai Parparita
parent 03b2c44a21
commit cef0a474f8

@ -89,6 +89,10 @@ func (b *LocalBackend) handleC2N(w http.ResponseWriter, r *http.Request) {
return
}
w.Header().Set("Content-Type", "text/plain")
if b.sockstatLogger == nil {
http.Error(w, "no sockstatLogger", http.StatusInternalServerError)
return
}
b.sockstatLogger.Flush()
fmt.Fprintln(w, b.sockstatLogger.LogID())
default:

Loading…
Cancel
Save