Skip to content
Snippets Groups Projects
Commit 21e8befc authored by ivan.rigo's avatar ivan.rigo
Browse files

Done? Need to ask prof for further detail

parent 47ff679a
No related branches found
No related tags found
No related merge requests found
...@@ -14,7 +14,6 @@ import ( ...@@ -14,7 +14,6 @@ import (
var arrFile []string var arrFile []string
var idServ string var idServ string
var port string
var parent int var parent int
var msgId = 0 var msgId = 0
var err error var err error
...@@ -41,12 +40,13 @@ var albums = []album{ ...@@ -41,12 +40,13 @@ var albums = []album{
func initReq(c *gin.Context) { func initReq(c *gin.Context) {
msgId = rand.Intn(100) msgId = rand.Intn(100)
parent = -1 parent = -1
foundRsc = false
printErr(err) printErr(err)
fmt.Println("\n Start of new research ")
for _, x := range arrFile { for _, x := range arrFile {
if x == c.Param("ressource") { if x == c.Param("ressource") {
if !foundRsc { fmt.Println("\n Ressource exist in Client ")
fmt.Println("Ressource exist in Client")
}
foundRsc = true foundRsc = true
break break
} }
...@@ -110,7 +110,7 @@ func foundReq(c *gin.Context) { ...@@ -110,7 +110,7 @@ func foundReq(c *gin.Context) {
printErr(err) printErr(err)
portFinder := strconv.Itoa(basePort + finderNb) portFinder := strconv.Itoa(basePort + finderNb)
if parent == -1 { 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 { } else {
sendFound(c.Param("ressource"), c.Param("finder")) sendFound(c.Param("ressource"), c.Param("finder"))
} }
...@@ -139,7 +139,6 @@ func main() { ...@@ -139,7 +139,6 @@ func main() {
for _, file := range files { for _, file := range files {
arrFile = append(arrFile, file.Name()) arrFile = append(arrFile, file.Name())
} }
port = strconv.Itoa(basePort + nbIdServ)
router := gin.Default() router := gin.Default()
router.GET("/initReq/:tlv/:ressource", initReq) router.GET("/initReq/:tlv/:ressource", initReq)
...@@ -153,5 +152,5 @@ func main() { ...@@ -153,5 +152,5 @@ func main() {
printErr(err) printErr(err)
fmt.Println(body) fmt.Println(body)
*/ */
router.Run("localhost:" + port) router.Run("localhost:" + strconv.Itoa(basePort+nbIdServ))
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment