Skip to content

Commit

Permalink
Merge pull request #83 from UlfBj/master
Browse files Browse the repository at this point in the history
Bugfixes in grpc and http mgrs
  • Loading branch information
UlfBj authored Jan 24, 2025
2 parents 4ce5094 + c3c4058 commit b69afec
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion client/client-1.0/testClient/testClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ import (
var testedProtocols []string = []string{
"http",
"ws",
"mqtt",
"grpc",
"mqtt",
}

var clientCert tls.Certificate
Expand Down
3 changes: 2 additions & 1 deletion runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ startme() {
echo "Starting feederv3"
screen -S feederv3 -dm bash -c "pushd feeder/feeder-template/feederv3 && go build && mkdir -p logs && ./feederv3 -i vssjson &> ./logs/feederv3-log.txt && popd"

sleep 3s
echo "Starting testClient"
screen -S testClient bash -c "pushd client/client-1.0/testClient && go build && ./testClient && popd"

Expand All @@ -24,7 +25,7 @@ stopme() {
echo "Stopping vissv2server"
screen -X -S vissv2server quit

sleep 1
sleep 1s
screen -wipe
}

Expand Down
8 changes: 5 additions & 3 deletions server/vissv2server/grpcMgr/grpcMgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ func RemoveRoutingForwardResponse(response string) {
func updateRoutingList(resp string, clientId int, isMultipleEvent bool) {
utils.Info.Printf("updateRoutingList:message=%s", resp)
if strings.Contains(resp, "unsubscribe") {
subscribeClientId, subscribeChan := getSubscribeRoutingData(resp)
subscribeChan <- KILL_MESSAGE + " clientId:" + strconv.Itoa(subscribeClientId)
_, subscribeChan := getSubscribeRoutingData(resp)
subscribeChan <- resp
resetGrpcRoutingData(clientId)
//utils.Info.Printf("updateRoutingList:unsubscribe clientid=%s, subscription clientid=%s", clientId, subscribeClientId)
} else if !isMultipleEvent { // get and set
Expand Down Expand Up @@ -199,7 +199,9 @@ func initGrpcServer() {
portNo = utils.SecureConfiguration.GrpcSecPort
utils.Info.Printf("initGrpcServer:port number=%s", portNo)
} else {
server = grpc.NewServer(grpc.StatsHandler(&Handler{}))
// server = grpc.NewServer(grpc.StatsHandler(&Handler{}))
var opts []grpc.ServerOption
server = grpc.NewServer(opts...)
portNo = "8887"
utils.Info.Printf("portNo =%s", portNo)
}
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions server/vissv2server/httpMgr/httpMgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func HttpMgrInit(mgrId int, transportMgrChan chan string) {
for {
select {
case reqMessage := <-HttpClientChan[0]:
utils.Info.Printf("HTTP mgr hub: Request from client:%s\n", reqMessage)
utils.Info.Printf("HTTP mgr hub: Request from client:%s", reqMessage)
validationError := utils.JsonSchemaValidate(reqMessage)
if len(validationError) > 0 {
var requestMap map[string]interface{}
Expand All @@ -46,7 +46,7 @@ func HttpMgrInit(mgrId int, transportMgrChan chan string) {
}
utils.AddRoutingForwardRequest(reqMessage, mgrId, 0, transportMgrChan)
case respMessage := <-transportMgrChan:
utils.Info.Printf("HTTP mgr hub: Response from server core:%s\n", respMessage)
utils.Info.Printf("HTTP mgr hub: Response from server core:%s", respMessage)
RemoveRoutingForwardResponse(respMessage, transportMgrChan)
}
}
Expand Down
4 changes: 3 additions & 1 deletion utils/managerhandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,9 @@ func frontendHttpAppSession(w http.ResponseWriter, req *http.Request, clientChan
case "POST": // set
requestMap["action"] = "set"
body, _ := io.ReadAll(req.Body)
requestMap["value"] = string(body)
var bodyMap map[string]interface{}
MapRequest(string(body), &bodyMap)
requestMap["value"] = bodyMap["value"]
default:
// http.Error(w, "400 Unsupported method", http.StatusBadRequest)
Warning.Printf("Only GET and POST methods are supported.")
Expand Down

0 comments on commit b69afec

Please sign in to comment.