Beispiel #1
0
 protected virtual void OnSent(SentEventArgs args)
 {
     if (this.Sent != null)
     {
         this.Sent(this, args);
     }
 }
Beispiel #2
0
 private void OnSent(object sender, SentEventArgs e)
 {
     if (!e.OperationSucceeded)
     {
         Connection conn = e.GetConnection();
         RemoveConnection(conn);
     }
 }
Beispiel #3
0
		private void Sender_Sent(object sender, SentEventArgs e)
		{
			var token = (SendToken)e.AsyncState;
			int index = Interlocked.Increment(ref _totalCount);

			try
			{
				//同步锁定,以防止异步并发中导致显示信息错位
				Monitor.Enter(_syncRoot);

				token.Context.Output.Write(CommandOutletColor.DarkYellow, "[{0}] ", index);
				token.Context.Output.Write(CommandOutletColor.Green, ResourceUtility.GetString("${Text.Communication.SendCommand.SendSucceed}"), token.Message);
				token.Context.Output.WriteLine(CommandOutletColor.DarkGray, ResourceUtility.GetString("${Text.Communication.SendCommand.Channel}"), e.Channel.ChannelId, e.Channel.LastSendTime);
			}
			finally
			{
				//退出同步锁定
				Monitor.Exit(_syncRoot);

				//设置信号量为非堵塞
				token.WaitHandle.Set();
			}
		}
Beispiel #4
0
 /// <summary>
 /// Called after network sent data.
 /// </summary>
 /// <param name="sender">The sender instance.</param>
 /// <param name="ev">The <see cref="SentEventArgs"/> instance.</param>
 protected virtual void OnSent(object sender, SentEventArgs ev) => Sent?.Invoke(sender, ev);
 /// <inheritdoc cref="API.Network.OnSent(object, SentEventArgs)"/>
 public void OnSent(object _, SentEventArgs ev) => Log.Debug(string.Format(Language.SentData, ev.Data, ev.Length), Instance.Config.IsDebugEnabled);
Beispiel #6
0
 private void Channel_Sent(object sender, SentEventArgs e)
 {
     this.OnSent(e);
 }
		private void Channel_Sent(object sender, SentEventArgs e)
		{
			this.OnSent(e);
		}
		protected virtual void OnSent(SentEventArgs args)
		{
			if(this.Sent != null)
				this.Sent(this, args);
		}