1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-12-22 23:35:46 +01:00

Add websocket handshake timeout.

This commit is contained in:
Juliusz Chroboczek 2021-01-04 18:02:50 +01:00
parent 7f4306ab3b
commit 5735322627

View file

@ -430,10 +430,12 @@ func statsHandler(w http.ResponseWriter, r *http.Request, dataDir string) {
fmt.Fprintf(w, "</body></html>\n")
}
var upgrader websocket.Upgrader
var wsUpgrader = websocket.Upgrader {
HandshakeTimeout: 30 * time.Second,
}
func wsHandler(w http.ResponseWriter, r *http.Request) {
conn, err := upgrader.Upgrade(w, r, nil)
conn, err := wsUpgrader.Upgrade(w, r, nil)
if err != nil {
log.Printf("Websocket upgrade: %v", err)
return