Commit 57353226 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Add websocket handshake timeout.

parent 7f4306ab
...@@ -430,10 +430,12 @@ func statsHandler(w http.ResponseWriter, r *http.Request, dataDir string) { ...@@ -430,10 +430,12 @@ func statsHandler(w http.ResponseWriter, r *http.Request, dataDir string) {
fmt.Fprintf(w, "</body></html>\n") 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) { 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 { if err != nil {
log.Printf("Websocket upgrade: %v", err) log.Printf("Websocket upgrade: %v", err)
return return
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment