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 (
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))
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment