/// <summary> /// OnSendCallback /// </summary> /// <param name="connection"></param> /// <param name="e"></param> protected override void OnSendCallback(IConnection connection, SendCallbackEventArgs e) { base.OnSendCallback(connection, e); try { this._handler.OnSendCallback(connection,e); } catch (Exception ex) { Log.Trace.Error(ex.Message, ex); } var request = e.Packet as Request; if (request == null) return; if (e.Status == SendCallbackStatus.Success) { request.CurrConnection = connection; request.SentTime = DateTime.UtcNow; this.OnSendSucess(connection, request); return; } request.CurrConnection = null; request.SentTime = DateTime.MaxValue; if (DateTime.UtcNow.Subtract(request.BeginTime).TotalMilliseconds < this._millisecondsSendTimeout) { this.OnSendFailed(connection, request); return; } //time out this.OnSendTimeout(request); ThreadPool.QueueUserWorkItem(_ => { var rex = new RequestException(RequestException.Errors.PendingSendTimeout); try { request.SetException(rex); } catch (Exception ex) { Log.Trace.Error(ex.Message, ex); } }); }