Exemple #1
0
func (rr *RemoteRaytracer) registerFunctions() {
	rr.Dispatcher.AddFunc("LoadScene", rr.LoadScene)
	rr.Dispatcher.AddFunc("Sample", rr.Sample)
	rr.Dispatcher.AddFunc("MaxRequestsAtOnce", rr.MaxRequestsAtOnce)
	rr.Dispatcher.AddFunc("MaxSamplesAtOnce", rr.MaxSamplesAtOnce)
	rr.Dispatcher.AddFunc("StoreSample", rr.StoreSample)
	rr.Dispatcher.AddFunc("GetImage", rr.GetImage)
	gorpc.RegisterType(&hdrimage.Image{})
	gorpc.RegisterType(&SampleSettings{})
}
Exemple #2
0
func init() {
	rpc.RegisterSessionMaker(pushMessageID, rpc.NewSessionHandlerFunc(makePushSession))

	d := rpc.Dispatcher()
	d.AddFunc(sendRepoMsg, handleSendRepo)
	d.AddFunc(StartDataMsg, handleStartData)
	d.AddFunc(PutKVMsg, handlePutKV)

	gorpc.RegisterType(&repoTxMsg{})
	gorpc.RegisterType(&DataTxInit{})
	gorpc.RegisterType(&KVMessage{})
}
Exemple #3
0
func init() {
	registered = make(map[MessageID]NewSessionHandlerFunc)
	handlers = make(map[SessionID]SessionHandler)

	// Create dispatcher for session creation and other functions.
	d := gorpc.NewDispatcher()
	d.AddFunc(sendNewSession, newSession)
	d.AddFunc(sendEndSession, endSession)
	dispatcher = d

	var m MessageID
	gorpc.RegisterType(m)
	var s SessionID
	gorpc.RegisterType(s)
}
Exemple #4
0
// Benchmark valyala/gorpc TCP connection for 2MB payload.
func BenchmarkPingPong_2MB_valyala(b *testing.B) {
	gorpc.RegisterType(&PostingList{})

	s := gorpc.NewTCPServer(":12345", PingPong)
	if err := s.Start(); err != nil {
		b.Fatal("While starting server on port 12345")
		return
	}
	defer s.Stop()

	req := NewRequest(mb2)
	c := gorpc.NewTCPClient(":12345")
	c.Start()
	defer c.Stop()

	b.ResetTimer()
	for i := 0; i < b.N; i++ {
		_, err := c.Call(req)
		if err != nil {
			b.Fatalf("While running request: %v", err)
			return
		}
	}
}
Exemple #5
0
func init() {
	d := rpc.Dispatcher()
	d.AddFunc(commandMsg, handleCommand)

	gorpc.RegisterType(&datastore.Request{})
}