1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-09-07 21:10:11 +00:00

tls: don't "crash" on server close

TLS server section called Fatalf, while the normal section called Printf
on server close. Fatalf is now only called if the server wasn't shutdown
manually, e.g. when certificates are wrong. Same change was applied to
non-tls section, so crashes will actually occur when things like ports are occupied.

Fixes #343.
This commit is contained in:
Harvey Tindall 2024-07-21 17:01:52 +01:00
parent a4d436b16b
commit 7c989fda08
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2
2 changed files with 10 additions and 3 deletions

12
main.go
View File

@ -566,11 +566,19 @@ func start(asDaemon, firstCall bool) {
}
}
app.err.Fatalf("Failure serving with SSL/TLS: %s", err)
if err == http.ErrServerClosed {
app.err.Printf("Failure serving with SSL/TLS: %s", err)
} else {
app.err.Fatalf("Failure serving with SSL/TLS: %s", err)
}
}
} else {
if err := SRV.ListenAndServe(); err != nil {
app.err.Printf("Failure serving: %s", err)
if err == http.ErrServerClosed {
app.err.Printf("Failure serving: %s", err)
} else {
app.err.Fatalf("Failure serving: %s", err)
}
}
}
}()

1
package-lock.json generated
View File

@ -15,7 +15,6 @@
"any-date-parser": "^1.5.4",
"browserslist": "^4.21.7",
"cheerio": "^1.0.0-rc.12",
"esbuild": "^0.18.20",
"fs-cheerio": "^3.0.0",
"inline-source": "^8.0.2",
"jsdom": "^22.1.0",