Ejemplo n.º 1
0
func StartBasicRPC() {
	server_addr = GetAddr()
	svr, err := protorpc.Serve(server_addr, false)
	if err != nil {
		log.Fatal("cant setup calc service:", err)
	}
	servers = append(servers, svr)
}
Ejemplo n.º 2
0
func StartBrokeredRPC() {
	broker_front = GetAddr()
	broker_back := GetAddr()
	broker, err := protorpc.NewBroker(broker_front, broker_back)
	if err != nil {
		log.Fatal("Error creating broker:", err)
	}
	go func() {
		broker.Serve()
	}()
	servers = append(servers, broker)
	<-time.After(50 * time.Millisecond)

	svr, err := protorpc.Serve(broker_back, true)
	if err != nil {
		log.Fatal("cant setup calc service:", err)
	}
	servers = append(servers, svr)
}