mirror of
https://github.com/jech/galene.git
synced 2024-11-22 16:45:58 +01:00
Add websocket handshake timeout.
This commit is contained in:
parent
7f4306ab3b
commit
5735322627
1 changed files with 4 additions and 2 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue