Exemple #1
0
func main() {
	go startPPROF()
	go logRate()

	s := srpc.NewServer(":12345")
	s.SetHandler("echo", handler)
	log.Println(s.Listen())
}
Exemple #2
0
func (s *server) Listen() (err error) {
	srv := srpc.NewServer(s.options.Address)
	srv.SetHandler("info", s.Info)
	srv.SetHandler("open", s.Open)
	srv.SetHandler("edit", s.Edit)
	srv.SetHandler("put", s.Put)
	srv.SetHandler("inc", s.Inc)
	srv.SetHandler("get", s.Get)
	srv.SetHandler("batch", s.Batch)
	srv.SetHandler("metrics", s.Metrics)

	log.Println("SRPCS:  listening on", s.options.Address)
	return srv.Listen()
}