diff --git a/cmd/calls/main.go b/cmd/calls/main.go index a756378..44805f1 100644 --- a/cmd/calls/main.go +++ b/cmd/calls/main.go @@ -107,19 +107,10 @@ func main() { } }() - ticker := time.NewTicker(time.Second) - defer ticker.Stop() - for { select { case <-done: return - case t := <-ticker.C: - err := c.WriteMessage(websocket.TextMessage, []byte(t.String())) - if err != nil { - log.Println("write:", err) - return - } case <-interrupt: log.Println("interrupt") diff --git a/pkg/gordio/auth/jwt.go b/pkg/gordio/auth/jwt.go index bc84034..25c5ec1 100644 --- a/pkg/gordio/auth/jwt.go +++ b/pkg/gordio/auth/jwt.go @@ -2,7 +2,6 @@ package auth import ( "context" - "fmt" "net/http" "strings" "time" @@ -103,7 +102,7 @@ func (a *authenticator) routeAuth(w http.ResponseWriter, r *http.Request) { } username, password := r.PostFormValue("username"), r.PostFormValue("password") if username == "" || password == "" { - http.Error(w, "blank credentials"+fmt.Sprint(r.Form), http.StatusBadRequest) + http.Error(w, "blank credentials", http.StatusBadRequest) return } diff --git a/pkg/gordio/nexus/websocket.go b/pkg/gordio/nexus/websocket.go index faff1b8..f33c632 100644 --- a/pkg/gordio/nexus/websocket.go +++ b/pkg/gordio/nexus/websocket.go @@ -87,7 +87,7 @@ func (conn *wsConn) readPump(reg Registry, c Client) { _, message, err := conn.ReadMessage() if err != nil { if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) { - log.Error().Err(err).Msg("read failed") + return } break @@ -153,6 +153,6 @@ func (conn *wsConn) writeMessage(w io.WriteCloser, msg *pb.Message) { } } -func (n *wsManager) InstallPrivateRoutes(r chi.Router) { +func (n *wsManager) PrivateRoutes(r chi.Router) { r.HandleFunc("/ws", n.serveWS) } diff --git a/pkg/gordio/server/routes.go b/pkg/gordio/server/routes.go index e1bd602..c96a560 100644 --- a/pkg/gordio/server/routes.go +++ b/pkg/gordio/server/routes.go @@ -18,7 +18,7 @@ func (s *Server) setupRoutes() { r.Group(func(r chi.Router) { // authenticated routes r.Use(s.auth.VerifyMiddleware(), s.auth.AuthMiddleware()) - s.nex.InstallPrivateRoutes(r) + s.nex.PrivateRoutes(r) }) r.Group(func(r chi.Router) {