Example #1
0
        public async System.Threading.Tasks.Task <R> DoAwaitCall(T arg, long timeOut,
                                                                 NetCore.ERouteTarget route = NetCore.ERouteTarget.Self,
                                                                 NetCore.NetConnection conn = null,
                                                                 NetCore.RPCRouter router   = null,
                                                                 byte userFlags             = 0)
        {
            if (conn == null)
            {
                conn = RPCProcessor.DefaultConnection;
            }
            var pkg = new NetCore.PkgWriter(arg.GetPkgSize());

            pkg.SetUserFlags(userFlags);
            RPCExecuter.RPCWait waiter = null;
            try
            {
                waiter = WritePkgHeader <T>(ref pkg, ref arg, timeOut, RPCAwaiter.NullCB, route, conn, router);

                OnWriteArugment(ref arg, ref pkg);

                if (conn != null)
                {
                    pkg.SendBuffer(conn);
                }
            }
            finally
            {
                pkg.Dispose();
            }

            waiter.Processor = this;
            var result = await RPCAwaiter.RPCWaitReturn <R>(waiter);

            return(result);
        }
Example #2
0
        public void DoHashCall(ref T arg,
                               NetCore.ERouteTarget route = NetCore.ERouteTarget.Self,
                               NetCore.NetConnection conn = null,
                               NetCore.RPCRouter router   = null,
                               byte userFlags             = 0)
        {
            if (conn == null)
            {
                conn = RPCProcessor.DefaultConnection;
            }
            var pkg = new NetCore.PkgWriter(arg.GetPkgSize());

            pkg.SetUserFlags(userFlags);
            try
            {
                WritePkgHeader_Hash <T>(ref pkg, ref arg, 0, null, route, conn, router);

                OnWriteArugment(ref arg, ref pkg);

                if (conn != null)
                {
                    pkg.SendBuffer(conn);
                }
            }
            finally
            {
                pkg.Dispose();
            }
        }
 protected override void OnWriteArgument(ref NetCore.PkgWriter pkg, ref ArgumentData data)
 {
     pkg.SetUserFlags(2);
     base.OnWriteArgument(ref pkg, ref data);
 }