From cafeafa592063556f14e49222e2813a164069ed5 Mon Sep 17 00:00:00 2001 From: "ivan.rigo" <ivan.rigo@etu.hesge.ch> Date: Mon, 28 Nov 2022 21:17:52 +0100 Subject: [PATCH] Done --- web-service-gin/main.go | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/web-service-gin/main.go b/web-service-gin/main.go index cee056b..a5229e9 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) + } } } } -- GitLab