fix as per code review comments

This commit is contained in:
mary-dcouto
2021-09-09 18:10:03 +05:30
parent dfba20e72a
commit b0aad945fc
+7 -5
View File
@@ -467,11 +467,11 @@ func serveIpc(conn net.Conn) {
log.Debug("pipe closed. client likely disconnected")
} else {
log.Errorf("unexpected error while reading line. %v", readErr)
//try to respond... likely won't work but try...
respondWithError(enc, "could not read line properly! exiting loop!", UNKNOWN_ERROR, readErr)
}
}
//try to respond... likely won't work but try...
respondWithError(enc, "connection closed due to shutdown request for ipc", UNKNOWN_ERROR, readErr)
log.Debugf("connection closed due to shutdown request for ipc: %v", readErr)
return
}
@@ -487,11 +487,12 @@ func serveIpc(conn net.Conn) {
dec := json.NewDecoder(strings.NewReader(msg))
var cmd dto.CommandMsg
if cmdErr := dec.Decode(&cmd); cmdErr == io.EOF {
break
respondWithError(enc, "could not decode command properly", UNKNOWN_ERROR, cmdErr)
continue
} else if cmdErr != nil {
log.Error(cmdErr)
respondWithError(enc, "could not decode command properly", UNKNOWN_ERROR, cmdErr)
break
continue
}
switch cmd.Function {
@@ -506,6 +507,7 @@ func serveIpc(conn net.Conn) {
var newId dto.AddIdentity
if err := addIdDec.Decode(&newId); err == io.EOF {
respondWithError(enc, "could not decode string properly", UNKNOWN_ERROR, err)
break
} else if err != nil {
log.Error(err)