ipn/ipnlocal: stay out of map poll when down

Fixes #2434

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2021-07-16 15:21:00 -07:00
committed by Brad Fitzpatrick
parent 798b0da470
commit 6eecf3c9d1
5 changed files with 124 additions and 69 deletions

View File

@@ -205,6 +205,13 @@ func (lc *LogCatcher) logsString() string {
return lc.buf.String()
}
// Reset clears the buffered logs from memory.
func (lc *LogCatcher) Reset() {
lc.mu.Lock()
defer lc.mu.Unlock()
lc.buf.Reset()
}
func (lc *LogCatcher) ServeHTTP(w http.ResponseWriter, r *http.Request) {
var body io.Reader = r.Body
if r.Header.Get("Content-Encoding") == "zstd" {