mirror of
https://github.com/mjl-/mox.git
synced 2024-12-26 16:33:47 +03:00
fix harmless race where the same value is written to a tls config concurrently
This commit is contained in:
parent
11eaa8cd1a
commit
e1dbc07dba
2 changed files with 6 additions and 2 deletions
3
Makefile
3
Makefile
|
@ -21,6 +21,9 @@ build1:
|
||||||
install: build0 frontend
|
install: build0 frontend
|
||||||
CGO_ENABLED=0 go install
|
CGO_ENABLED=0 go install
|
||||||
|
|
||||||
|
race: build0
|
||||||
|
go build -race
|
||||||
|
|
||||||
test:
|
test:
|
||||||
CGO_ENABLED=0 go test -shuffle=on -coverprofile cover.out ./...
|
CGO_ENABLED=0 go test -shuffle=on -coverprofile cover.out ./...
|
||||||
go tool cover -html=cover.out -o cover.html
|
go tool cover -html=cover.out -o cover.html
|
||||||
|
|
|
@ -772,8 +772,9 @@ func listen1(ip string, port int, tlsConfig *tls.Config, name string, kinds []st
|
||||||
}
|
}
|
||||||
|
|
||||||
server := &http.Server{
|
server := &http.Server{
|
||||||
Handler: handler,
|
Handler: handler,
|
||||||
TLSConfig: tlsConfig,
|
// Clone because our multiple Server.Serve calls modify config concurrently leading to data race.
|
||||||
|
TLSConfig: tlsConfig.Clone(),
|
||||||
ReadHeaderTimeout: 30 * time.Second,
|
ReadHeaderTimeout: 30 * time.Second,
|
||||||
IdleTimeout: 65 * time.Second, // Chrome closes connections after 60 seconds, firefox after 115 seconds.
|
IdleTimeout: 65 * time.Second, // Chrome closes connections after 60 seconds, firefox after 115 seconds.
|
||||||
ErrorLog: golog.New(mlog.LogWriter(pkglog.With(slog.String("pkg", "net/http")), slog.LevelInfo, protocol+" error"), "", 0),
|
ErrorLog: golog.New(mlog.LogWriter(pkglog.With(slog.String("pkg", "net/http")), slog.LevelInfo, protocol+" error"), "", 0),
|
||||||
|
|
Loading…
Reference in a new issue