tstest: make MemLogger.String acquire its mutex

Updates #2781 (might even fix it, but its real issue is that
SetPrivateKey starts a ReSTUN goroutines which then logs, and
that bug and data race existed prior to MemLogger existing)
pull/2828/head
Brad Fitzpatrick 2021-09-09 11:35:04 -07:00
parent a76c8eea58
commit a353fbd3b4
1 changed files with 6 additions and 0 deletions

View File

@ -139,3 +139,9 @@ func (ml *MemLogger) Logf(format string, args ...interface{}) {
ml.Buffer.WriteByte('\n')
}
}
func (ml *MemLogger) String() string {
ml.Lock()
defer ml.Unlock()
return ml.Buffer.String()
}