From 21e8befcc8db6dbaa403c3e6b89de8eb6938dd19 Mon Sep 17 00:00:00 2001
From: "ivan.rigo" <ivan.rigo@etu.hesge.ch>
Date: Sun, 27 Nov 2022 13:49:43 +0100
Subject: [PATCH] Done? Need to ask prof for further detail

---
 web-service-gin/main.go | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/web-service-gin/main.go b/web-service-gin/main.go
index 861748b..cee056b 100644
--- a/web-service-gin/main.go
+++ b/web-service-gin/main.go
@@ -14,7 +14,6 @@ import (
 
 var arrFile []string
 var idServ string
-var port string
 var parent int
 var msgId = 0
 var err error
@@ -41,12 +40,13 @@ var albums = []album{
 func initReq(c *gin.Context) {
 	msgId = rand.Intn(100)
 	parent = -1
+	foundRsc = false
 	printErr(err)
+
+	fmt.Println("\n Start of new research      ")
 	for _, x := range arrFile {
 		if x == c.Param("ressource") {
-			if !foundRsc {
-				fmt.Println("Ressource exist in Client")
-			}
+			fmt.Println("\n Ressource exist in Client ")
 			foundRsc = true
 			break
 		}
@@ -110,7 +110,7 @@ func foundReq(c *gin.Context) {
 	printErr(err)
 	portFinder := strconv.Itoa(basePort + finderNb)
 	if parent == -1 {
-		fmt.Println("Instance of " + c.Param("ressource") + " found in " + portFinder)
+		fmt.Println("\n Instance of " + c.Param("ressource") + " found in " + portFinder)
 	} else {
 		sendFound(c.Param("ressource"), c.Param("finder"))
 	}
@@ -139,7 +139,6 @@ func main() {
 	for _, file := range files {
 		arrFile = append(arrFile, file.Name())
 	}
-	port = strconv.Itoa(basePort + nbIdServ)
 
 	router := gin.Default()
 	router.GET("/initReq/:tlv/:ressource", initReq)
@@ -153,5 +152,5 @@ func main() {
 	   printErr(err)
 	   fmt.Println(body)
 	*/
-	router.Run("localhost:" + port)
+	router.Run("localhost:" + strconv.Itoa(basePort+nbIdServ))
 }
-- 
GitLab