Remove debug lines
This commit is contained in:
parent
1899b1ab4b
commit
437cc2bfd1
12
websocket.go
12
websocket.go
|
@ -4,7 +4,6 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
|
||||||
"github.com/gorilla/websocket"
|
"github.com/gorilla/websocket"
|
||||||
"github.com/julienschmidt/httprouter"
|
"github.com/julienschmidt/httprouter"
|
||||||
"github.com/pterodactyl/wings/config"
|
"github.com/pterodactyl/wings/config"
|
||||||
|
@ -82,9 +81,6 @@ func (rt *Router) AuthenticateWebsocket(h httprouter.Handle) httprouter.Handle {
|
||||||
|
|
||||||
defer resp.Body.Close()
|
defer resp.Body.Close()
|
||||||
if resp.StatusCode != http.StatusNoContent {
|
if resp.StatusCode != http.StatusNoContent {
|
||||||
b, _ := ioutil.ReadAll(resp.Body)
|
|
||||||
|
|
||||||
zap.S().Warnw("failed to validate token with server", zap.String("response", string(b)))
|
|
||||||
http.Error(w, "failed to validate token with server", resp.StatusCode)
|
http.Error(w, "failed to validate token with server", resp.StatusCode)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -103,8 +99,6 @@ func (rt *Router) routeWebsocket(w http.ResponseWriter, r *http.Request, ps http
|
||||||
}
|
}
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
|
|
||||||
fmt.Println("running websocket route")
|
|
||||||
|
|
||||||
s := rt.Servers.Get(ps.ByName("server"))
|
s := rt.Servers.Get(ps.ByName("server"))
|
||||||
handler := WebsocketHandler{
|
handler := WebsocketHandler{
|
||||||
Server: s,
|
Server: s,
|
||||||
|
@ -146,7 +140,6 @@ func (rt *Router) routeWebsocket(w http.ResponseWriter, r *http.Request, ps http
|
||||||
|
|
||||||
for {
|
for {
|
||||||
j := WebsocketMessage{inbound: true}
|
j := WebsocketMessage{inbound: true}
|
||||||
fmt.Println("running for{} loop...")
|
|
||||||
|
|
||||||
if _, _, err := c.ReadMessage(); err != nil {
|
if _, _, err := c.ReadMessage(); err != nil {
|
||||||
if !websocket.IsCloseError(err, websocket.CloseNormalClosure, websocket.CloseGoingAway, websocket.CloseNoStatusReceived, websocket.CloseServiceRestart) {
|
if !websocket.IsCloseError(err, websocket.CloseNormalClosure, websocket.CloseGoingAway, websocket.CloseNoStatusReceived, websocket.CloseServiceRestart) {
|
||||||
|
@ -159,18 +152,13 @@ func (rt *Router) routeWebsocket(w http.ResponseWriter, r *http.Request, ps http
|
||||||
// specific socket request. If we did a break here the client would get disconnected
|
// specific socket request. If we did a break here the client would get disconnected
|
||||||
// from the socket, which is NOT what we want to do.
|
// from the socket, which is NOT what we want to do.
|
||||||
if err := c.ReadJSON(&j); err != nil {
|
if err := c.ReadJSON(&j); err != nil {
|
||||||
fmt.Println("ReadJSON() error")
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := handler.HandleInbound(j); err != nil {
|
if err := handler.HandleInbound(j); err != nil {
|
||||||
zap.S().Warnw("error handling inbound websocket request", zap.Error(err))
|
zap.S().Warnw("error handling inbound websocket request", zap.Error(err))
|
||||||
break
|
break
|
||||||
} else {
|
|
||||||
zap.S().Debugw("handled event", zap.String("event", j.Event), zap.Strings("args", j.Args))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("finished looping...")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user