Explorar el Código

avoid sending msg onb closed channel

abhishek9686 hace 1 año
padre
commit
0de762240b
Se han modificado 1 ficheros con 4 adiciones y 1 borrados
  1. 4 1
      auth/host_session.go

+ 4 - 1
auth/host_session.go

@@ -133,7 +133,10 @@ func SessionHandler(conn *websocket.Conn) {
 	go func() {
 		for {
 			msgType, _, err := conn.ReadMessage()
-			if err != nil || msgType == websocket.CloseMessage {
+			if err != nil {
+				return
+			}
+			if msgType == websocket.CloseMessage {
 				if timeout != nil {
 					timeout <- true
 				}