fix: avoid setting read limit on nil conn
This commit is contained in:
parent
075bee6a00
commit
b27c9fe7bc
2
main.go
2
main.go
@ -173,11 +173,11 @@ func (h *Handler) LoadPeers(filename string) error {
|
|||||||
|
|
||||||
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
wsConn, err := websocket.Accept(w, r, nil)
|
wsConn, err := websocket.Accept(w, r, nil)
|
||||||
wsConn.SetReadLimit(-1)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithField("client", r.RemoteAddr).Error(err)
|
log.WithField("client", r.RemoteAddr).Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
wsConn.SetReadLimit(-1)
|
||||||
go h.ServeWebSocket(wsConn, r.RemoteAddr)
|
go h.ServeWebSocket(wsConn, r.RemoteAddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user