void IClient.Push(MethodReturnArgs args) { lock (mPool) { mPool.Push(args); } }
void IClient.RegisterRemote(long id, MethodReturnArgs e) { lock (mRemotingMethods) { mRemotingMethods[id] = e; } }
MethodReturnArgs IClient.Pop() { MethodReturnArgs result; lock (mPool) { if (mPool.Count > 0) { result = mPool.Pop(); result.Reset(); } result = new MethodReturnArgs(); return(result); } }
private void OnReceive(object sender, PackageReceiveArgs e) { lock (this) { if (e.Message is Remoting.RPC.MethodResult) { Remoting.RPC.MethodResult result = (Remoting.RPC.MethodResult)e.Message; if (mRemotingMethods.TryGetValue(result.ID, out mMethodReturnArgs)) { mMethodReturnArgs.Import(result); } } else { if (mMethodReturnArgs == null) { if (Receive != null) { Receive(sender, e); } } else { if (mMethodReturnArgs.Status == InvokeStatus.Return) { mMethodReturnArgs.SetReturn(e.Message); } else if (mMethodReturnArgs.Status == InvokeStatus.Parameter) { mMethodReturnArgs.AddParameter(e.Message); } } } if (mMethodReturnArgs != null && mMethodReturnArgs.Status == InvokeStatus.Completed) { mMethodReturnArgs.Completed(); mMethodReturnArgs = null; } } }