Lint fixes

This commit is contained in:
Łukasz Magiera 2019-07-15 18:32:43 +02:00
parent 3fca70f112
commit 661043f5c8
4 changed files with 22 additions and 20 deletions

View File

@ -35,9 +35,13 @@ func (s *RPCServer) handleWS(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(500)
return
}
defer c.Close()
handleWsConn(r.Context(), c, s.methods, nil, nil)
if err := c.Close(); err != nil {
log.Error(err)
return
}
}
// TODO: return errors to clients per spec

View File

@ -137,11 +137,10 @@ func handleWsConn(ctx context.Context, conn *websocket.Conn, handler handlers, r
nw := func(cb func(io.Writer)) {
cb(ioutil.Discard)
}
done := func(){}
done := cf
if frame.ID != nil {
nw = nextWriter
handlingLk.Lock()
handling[*frame.ID] = cf
handlingLk.Unlock()
@ -150,7 +149,6 @@ func handleWsConn(ctx context.Context, conn *websocket.Conn, handler handlers, r
handlingLk.Lock()
defer handlingLk.Unlock()
cf := handling[*frame.ID]
cf()
delete(handling, *frame.ID)
}