Пример #1
0
func runWatcher(path string) {

	if path == "" {
		fmt.Printf("Missing configuration")
		return

	}

	// setup env
	if err := server.NewEnv(path); err != nil {
		return
	}

	// create a fake server
	fs := new(fakeServer)
	fs.bootstrap()

	readych := make(chan bool) // blocking

	go protocol.RunWatcherServerWithElection(
		server.GetHostUDPAddr(),
		server.GetPeerUDPAddr(),
		server.GetPeerTCPAddr(),
		nil,
		fs.handler,
		fs.factory,
		fs.killch,
		readych)

	<-readych

	runConsole(fs)
}
Пример #2
0
func (s *fakeServer) GetEnsembleSize() uint64 {
	return uint64(len(server.GetPeerUDPAddr())) + 1 // including myself
}