예제 #1
0
파일: busstub.go 프로젝트: skOak/chestnut
func (bs *BusStub) call(client *myrpc.RPC, serviceMethod string, args interface{}, reply interface{}) (err error) {
	defer func() {
		log.Printf("BusStub call\nFrom %s(%s) to (%s) with error(%v)\nServiceMethod:%s\nArgs:%+v\nReply:%+v\n",
			bs.selfServer.Name, bs.selfServer.Host, client.GetTargetAddr(), err,
			serviceMethod,
			args,
			reply)
	}()
	if client == nil {
		return errorNullPointer
	}
	return client.Call(serviceMethod, args, reply)
}
예제 #2
0
파일: busstub.go 프로젝트: skOak/chestnut
func (bs *BusStub) makeGo(client *myrpc.RPC, serviceMethod string, args interface{}, reply interface{}) (retErr chan error, err error) {
	defer func() {
		log.Printf("BusStub makeGo\nFrom %s(%s) to (%s) with error(%v)\nServiceMethod:%s\nArgs:%+v\nReply:%+v\n",
			bs.selfServer.Name, bs.selfServer.Host, client.GetTargetAddr(), err,
			serviceMethod,
			args,
			reply)
	}()
	if client == nil {
		err = errorNullPointer
		return
	}
	retErr = client.Go(serviceMethod, args, reply)
	return
}
예제 #3
0
파일: busserver.go 프로젝트: skOak/chestnut
func (bs *BusServer) OnMyRpcConnsBroken(rpcClient *myrpc.RPC, err error) {
	if rpcClient == nil {
		return
	}
	log.Printf("BusServer.OnMyRpcConnsBroken : myrpc conn to %s is broken with err(%v)\n", rpcClient.GetTargetAddr(), err)

	// Todo:optimize searching the right conn
	var foundService *Server
	for _, s := range bs.serviceById {
		if s.RPCClient == rpcClient {
			// found
			foundService = s
		}
	}

	if foundService != nil {
		bs.deleteServer(foundService)
	}
}