Skip to content

Commit

Permalink
Merge pull request #58 from UlfBj/master
Browse files Browse the repository at this point in the history
WSmgr cleanup
  • Loading branch information
UlfBj authored Nov 25, 2024
2 parents 65d212f + 21cebfd commit 26ce920
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions client/client-1.0/Javascript/wsclient.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<html>
<body>

<h2>Websocket client example, uncompressed messages</h2>
<h2>Websocket client example, unencoded messages</h2>

<div>
<input id="host-ip" type="text" placeholder="host ip"/>
Expand Down Expand Up @@ -52,7 +52,7 @@ <h2>Websocket client example, uncompressed messages</h2>
try {
function setHostIP() {
hostIP = externHostIp.value;
socket = new WebSocket("ws://" + hostIP + ":8080", "VISSv2");
socket = new WebSocket("ws://" + hostIP + ":8080", "VISS-noenc");

socket.onopen = function () {
output.innerHTML += "Status: Connected\n";
Expand Down
5 changes: 4 additions & 1 deletion server/vissv2server/serviceMgr/serviceMgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -1006,14 +1006,17 @@ func configureDefault(udsConn net.Conn) {
func feederFrontend(toFeeder chan string, fromFeederRorC chan string, fromFeederCl chan string) {
var udsConn net.Conn
attempts := 0
utils.Info.Printf("feederFrontend:Trying to connect to feeder...")
for udsConn == nil && attempts < 10 {
udsConn = utils.GetUdsConn("*", "serverFeeder")
if udsConn == nil && attempts >= 10-1 {
utils.Error.Printf("feederFrontend:Failed to UDS connect to feeder.")
return // ???
}
attempts++
time.Sleep(3 * time.Second)
}
utils.Info.Printf("feederFrontend:Connected to feeder.")
configureDefault(udsConn)
fromFeeder := make(chan string)
go feederReader(udsConn, fromFeeder)
Expand Down Expand Up @@ -1474,7 +1477,7 @@ func ServiceMgrInit(mgrId int, serviceMgrChan chan string, stateStorageType stri
_, subscriptionList = scanAndRemoveListItem(subscriptionList, routerId)
}
default:
utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data
utils.SetErrorResponse(requestMap, errorResponseMap, 1, "Unknown action") //invalid_data
dataChan <- utils.FinalizeMessage(errorResponseMap)
} // switch
case <-dummyTicker.C:
Expand Down
2 changes: 1 addition & 1 deletion server/vissv2server/vissv2server.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ func issueServiceRequest(requestMap map[string]interface{}, tDChanIndex int, sDC
return
}
if requestMap["action"] == "set" && nodeType != utils.ACTUATOR {
utils.SetErrorResponse(requestMap, errorResponseMap, 1, "") //invalid_data
utils.SetErrorResponse(requestMap, errorResponseMap, 1, "Forbidden to write to read-only resource.") //invalid_data
backendChan[tDChanIndex] <- utils.FinalizeMessage(errorResponseMap)
return
}
Expand Down
2 changes: 1 addition & 1 deletion utils/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func getSocketPath(listIndex int, connectionName string) string {
func connectViaUds(sockFile string) net.Conn {
udsConn, err := net.Dial("unix", sockFile)
if err != nil {
Error.Printf("connectViaUds:UDS Dial failed, err = %s", err)
// Error.Printf("connectViaUds:UDS Dial failed, err = %s", err)
return nil
}
return udsConn
Expand Down

0 comments on commit 26ce920

Please sign in to comment.