func initMaster(storage, server, myhostport string) bool { mn = masternode.NewMaster(5001, storage) if mn == nil { fmt.Println("Could not start master node/app logic") return false } return true }
func testNonexistantRssStore() { if master := masternode.NewMaster(5001, "localhost:5002"); master == nil { fmt.Println("PASS") passCount++ } else { fmt.Println("FAIL") failCount++ } cleanupMaster(nil) }
func initMaster(storage, server, myhostport string) net.Listener { l := initRssStore(storage, 5002, 1, 0) if l == nil { return nil } mn = masternode.NewMaster(5001, storage) if mn == nil { fmt.Println("Could not start master node/app logic") return nil } return l }
// Core Routine func main() { // Parse command-line flags var port int var rssServer string flag.IntVar(&port, "p", 5001, "Listening Port") flag.StringVar(&rssServer, "s", "localhost:5002", "Storage server to get list from") flag.Parse() mn := masternode.NewMaster(port, rssServer) // Begin servicing RPC requests rpc.Register(masternoderpc.NewMasterNodeRPC(mn)) rpc.HandleHTTP() l, e := net.Listen("tcp", fmt.Sprintf(":%d", port)) if e != nil { fmt.Printf("Fatal Listen Error:%v\n", e) return } http.Serve(l, nil) }