private void OnSocketError(IClient c, ClientErrorArgs e) { HttpApiServer httpApiServer = Server.Gateway.HttpServer; if (httpApiServer.EnableLog(BeetleX.EventArgs.LogType.Error)) { httpApiServer.Log(BeetleX.EventArgs.LogType.Error, $"gateway request {Server.Host}:{Server.Port} error {e.Message}@{e.Error.InnerException?.Message} status {Status}"); } if (Status == RequestStatus.Requesting) { EventResponseErrorArgs erea; if (e.Error is SocketException) { Code = Gateway.SERVER_SOCKET_ERROR; erea = new EventResponseErrorArgs(Request, Response, UrlRoute.Gateway, e.Error.Message, Gateway.SERVER_SOCKET_ERROR); } else { Code = Gateway.SERVER_PROCESS_ERROR_CODE; erea = new EventResponseErrorArgs(Request, Response, UrlRoute.Gateway, e.Error.Message, Gateway.SERVER_PROCESS_ERROR_CODE); } OnCompleted(erea); } else { Code = Gateway.SERVER_OTHRER_ERROR_CODE; if (Status > RequestStatus.None) { OnCompleted(null); } } }
private void OnError(IClient client, ClientErrorArgs e) { try { NetError.Invoke(client, e); } catch { } }
/// <summary> /// 记录异常错误 /// </summary> /// <param name="Error"></param> public void ExecuteRecordLog(ClientErrorArgs Error) { String ExceptionInfomations = $"Service errored with exception:【{Error.Message}】====write time:{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}\n"; var Diretories = Path.Combine(AppContext.BaseDirectory, "SocketError"); if (!Directory.Exists(Diretories)) { Directory.CreateDirectory(Diretories); } File.AppendAllText(Path.Combine(Diretories, "SocketErrorInfo.log"), ExceptionInfomations); Console.WriteLine(ExceptionInfomations); }
private void OnError(IClient c, ClientErrorArgs e) { if (e.Error is BeetleX.BXException || e.Error is System.Net.Sockets.SocketException || e.Error is System.ObjectDisposedException) { c.DisConnect(); OnCompleted(ResultType.NetError, e.Error.Message); } else { OnCompleted(ResultType.DataError, e.Error.Message); } }
private void MinerServer_OnClientError(object sender, ClientErrorArgs e) { Miner miner = _minerManager.GetMiner(e.connection); if (miner != null) { Log.Information("{0} has disconnected for {1}", miner.workerIdentifier, _poolClient.poolEndPoint); _minerManager.RemoveMiner(miner); } else { Log.Information("{0} has disconnected for {1}", e.connection.endPoint, _poolClient.poolEndPoint); } _poolClient.IsPoolConnectionRequired(); }
void EventClientError(IClient c, ClientErrorArgs e) { if (CurrentTask == null) { RecordLog(LogLevel.Error, $"[NoMessage]{e.Message}\n{e.Error}"); return; } var task = CurrentTask; RecordLog(LogLevel.Error, $"[{task.Message.ID}]{e.Message}\n{e.Error}"); task.Message.State = MessageState.NetworkError; task.Result.State = MessageState.NetworkError; var wait = task.WaitingTask; if (wait != null) { wait.TrySetResult(task.Result); } }
private void OnClientError(IClient c, ClientErrorArgs e) { if (OnWSConnected) { if (e.Error is BXException) { OnWSConnected = false; } lock (mLockReceive) { if (mReceiveCompletionSource != null) { var completed = mReceiveCompletionSource; mReceiveCompletionSource = null; Task.Run(() => { completed.Error(e.Error); }); return; } } if (DataReceive != null) { try { WSReceiveArgs wse = new WSReceiveArgs(); wse.Client = this; wse.Error = e.Error; DataReceive?.Invoke(this, wse); } catch { } } } else { OnConnectResponse(e.Error, null); } }
private void OnClientError(IClient c, ClientErrorArgs e) { if (OnWSConnected) { if (e.Error is BXException) { OnWSConnected = false; } try { WSReceiveArgs wse = new WSReceiveArgs(); wse.Client = this; wse.Error = e.Error; DataReceive?.Invoke(this, wse); } catch { } } else { OnConnectResponse(e.Error, null); } }
private void OnSocketError(IClient c, ClientErrorArgs e) { Error = e.Error.Message; if (Status == RequestStatus.Requesting) { if (e.Error is SocketException) { Code = RECEIVE_SOCKET_ERROR; } else { Code = RECEIVE_PROCESS_ERROR; } OnCompleted(); } else { Code = RECEIVE_DATA_ERROR; if (Status > RequestStatus.None) { OnCompleted(); } } }
private void onEventClientError(IClient c, ClientErrorArgs e) { requestResult.TrySetException(e.Error); }
// Dunno if sender should really be null for the event invocations, but I can't use this 'cause static class, so.... internal static void InvokeClientError(ClientErrorArgs args) { ClientError?.Invoke(null, args); }