summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rhimportd/ctrlWebSocket.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/rhimportd/ctrlWebSocket.go b/src/rhimportd/ctrlWebSocket.go
index 4dd43a7..edd4b9d 100644
--- a/src/rhimportd/ctrlWebSocket.go
+++ b/src/rhimportd/ctrlWebSocket.go
@@ -329,7 +329,6 @@ func webSocketHandler(conf *rhimport.Config, db *rddb.DBChan, sessions *rhimport
t, r, err := ws.NextReader()
if err != nil {
rhdl.Println("WebSocket Client", ws.RemoteAddr(), "disconnected:", err)
- // sendWebSocketErrorResponse(ws, http.StatusBadRequest, err.Error())
return
}
@@ -340,18 +339,20 @@ func webSocketHandler(conf *rhimport.Config, db *rddb.DBChan, sessions *rhimport
if err == io.EOF {
err = io.ErrUnexpectedEOF
}
- rhdl.Println("WebSocket Client", ws.RemoteAddr(), "disconnected:", err)
- // sendWebSocketErrorResponse(ws, http.StatusBadRequest, err.Error())
+ rhdl.Println("WebSocket Client", ws.RemoteAddr(), "request error:", err)
+ sendWebSocketErrorResponse(ws, http.StatusBadRequest, err.Error())
return
- } else {
- // rhdl.Printf("Websocket Client %s got: %+v", ws.RemoteAddr(), reqdata)
- reqchan <- *reqdata
}
+ // rhdl.Printf("Websocket Client %s got: %+v", ws.RemoteAddr(), reqdata)
+ reqchan <- *reqdata
case websocket.BinaryMessage:
data, err := ioutil.ReadAll(r)
if err != nil {
+ if err == io.EOF {
+ err = io.ErrUnexpectedEOF
+ }
rhdl.Println("WebSocket Client", ws.RemoteAddr(), "disconnected:", err)
- // sendWebSocketErrorResponse(ws, http.StatusBadRequest, err.Error())
+ sendWebSocketErrorResponse(ws, http.StatusInternalServerError, err.Error())
return
}
// rhdl.Printf("WebSocket Client %s: got binary message (%d bytes)", ws.RemoteAddr(), len(data))