Exemple #1
0
// Begin2 is the RPC version of vtgateservice.VTGateService method
func (vtg *VTGateP3) Begin2(ctx context.Context, request *pb.BeginRequest, response *pb.BeginResponse) (err error) {
	defer vtg.server.HandlePanic(&err)
	ctx, cancel := context.WithDeadline(ctx, time.Now().Add(*rpcTimeout))
	defer cancel()
	ctx = callerid.NewContext(ctx,
		request.CallerId,
		callerid.NewImmediateCallerID("gorpc client"))
	// Don't pass in a nil pointer
	session := &proto.Session{}
	vtgErr := vtg.server.Begin(ctx, session)
	response.Session = proto.SessionToProto(session)
	response.Error = vtgate.VtGateErrorToVtRPCError(vtgErr, "")
	if *vtgate.RPCErrorOnlyInReply {
		return nil
	}
	return vtgErr
}