fix: (issues/7): Client is sending agent to router(s) and collecting response(s).

This commit is contained in:
James Wells 2021-04-03 16:39:33 -07:00
parent f67d6da01d
commit 4a93101d85
Signed by: jwells
GPG key ID: 73196D10B8E65666
6 changed files with 33 additions and 19 deletions

View file

@ -1,13 +1,12 @@
package main
import (
// "fmt"
"io/ioutil"
"log"
"os"
"time"
// "math/rand"
"time"
gs "git.dragonheim.net/dragonheim/gagent/src/gstructs"
@ -131,16 +130,15 @@ func main() {
os.Exit(exitCodes.m["AGENT_NOT_DEFINED"])
}
agent, err := ioutil.ReadFile(arguments["--agent"].(string))
if err == nil {
// log.Printf("Agent containts %v\n", string(agent))
log.Printf("Forking...\n")
go gc.Main(config, string(agent))
log.Printf("Forked thread has completed\n")
time.Sleep(10 * time.Second)
} else {
if err != nil {
log.Printf("Failed to load Agent file: %s", arguments["--agent"])
os.Exit(exitCodes.m["AGENT_LOAD_FAILED"])
}
for key := range config.Routers {
log.Printf("Calling for router %d", key)
go gc.Main(config, key, string(agent))
time.Sleep(10 * time.Second)
}
case "router":
/*