diff --git a/web-service-gin/main.go b/web-service-gin/main.go index cee056b336f3a02550e8ee98d1ca3d20bce635a5..a5229e90fbaa3a5b6856f47cbf4fe17a54082ca3 100644 --- a/web-service-gin/main.go +++ b/web-service-gin/main.go @@ -74,28 +74,28 @@ func receiveReq(c *gin.Context) { msgId = idMsgInt parent = transmitterId foundRsc = false - } - for _, x := range arrFile { - if x == c.Param("ressource") { - if !foundRsc { - go sendFound(c.Param("ressource"), idServ) + for _, x := range arrFile { + if x == c.Param("ressource") { + if !foundRsc { + go sendFound(c.Param("ressource"), idServ) + } + foundRsc = true + break } - foundRsc = true - break } - } - tlv = tlv - 1 - if tlv != 0 { - for i := 0; i < len(albums); i++ { - //Open Neighb reg of this node - if albums[i].ID == idServ { - for j := 0; j < len(albums[i].Neighb); j++ { - if transmitterId != albums[i].Neighb[j] && parent != albums[i].Neighb[j] { - resp, err := http.Get("http://localhost:" + strconv.Itoa(basePort+albums[i].Neighb[j]) + "/req/" + idServ + "/" + strconv.Itoa(tlv) + "/" + strconv.Itoa(msgId) + "/" + c.Param("ressource")) - printErr(err) - fmt.Println(resp.Status) + tlv = tlv - 1 + if tlv != 0 { + for i := 0; i < len(albums); i++ { + //Open Neighb reg of this node + if albums[i].ID == idServ { + for j := 0; j < len(albums[i].Neighb); j++ { + if parent != albums[i].Neighb[j] { + resp, err := http.Get("http://localhost:" + strconv.Itoa(basePort+albums[i].Neighb[j]) + "/req/" + idServ + "/" + strconv.Itoa(tlv) + "/" + strconv.Itoa(msgId) + "/" + c.Param("ressource")) + printErr(err) + fmt.Println(resp.Status) + } } } }