private ReturnResult SendDataAsWait(long Id, byte[] Data) { using (ReturnEventWaitHandle wait = new ReturnEventWaitHandle(MillisecondsTimeout, false, EventResetMode.AutoReset)) { if (!SyncWaitDic.TryAdd(Id, wait)) { LogAction.Log(LogType.Err, "Insert Wait Dic fail"); return(null); } Client.Send(Data); wait.WaitOne(); var value = wait.Result; wait.Dispose(); if (value != null) { if (value.Arguments == null) { return(null); } else { return(value); } } else { return(null); } } }
private Result SendDataAsWait(long Id, byte[] Data) { using (ReturnEventWaitHandle wait = new ReturnEventWaitHandle(this.LoggerFactory, MillisecondsTimeout, false, EventResetMode.AutoReset)) { if (!SyncWaitDic.TryAdd(Id, wait)) { Log.Error("Insert Wait Dic fail"); } ClientManager.SendData(Data); if (!wait.WaitOne()) { throw new TimeoutException("Call Time Out"); } var value = wait.Result; if (value != null) { if (value.Arguments == null && !value.IsError) { return(null); } else { return(value); } } else { return(null); } } }