コード例 #1
0
ファイル: Connection.cs プロジェクト: swordlegend/Langrisser
 // Token: 0x06006AF7 RID: 27383 RVA: 0x001E00BC File Offset: 0x001DE2BC
 private void OnCompletedForSendImpl(SocketAsyncEventArgs e)
 {
     try
     {
         if (e.SocketError == SocketError.Success)
         {
             return;
         }
         throw new Exception("The result of SendAsync is not correct");
     }
     catch (Exception ex)
     {
         CCMSGConnectionSendFailure msg = new CCMSGConnectionSendFailure
         {
             ExceptionInfo = ex.ToString()
         };
         this.WriteMsg2RecvCache(msg);
     }
     if (this.State == ConnectionState.Established)
     {
         this.State = ConnectionState.Closed;
         CCMSGConnectionBreak msg2 = new CCMSGConnectionBreak();
         this.WriteMsg2RecvCache(msg2);
         this.FireEventOnLogPrint("OnCompletedForSendImpl", string.Empty);
     }
 }
コード例 #2
0
        //The callback of BeginSend on fuction "SendMessage"
        private void OnCompletedForSendImpl(SocketAsyncEventArgs e)
        {
            try
            {
                if (e.SocketError == SocketError.Success)
                {
                    return;
                }
                else
                {
                    throw new Exception("The result of SendAsync is not correct");
                }
            }
            catch (Exception ex)
            {
                // Connection exception means connection is disconnected
                CCMSGConnectionSendFailure failureMsg = new CCMSGConnectionSendFailure();
                failureMsg.ExceptionInfo = ex.ToString();
                lock (RecvQueue)
                {
                    RecvQueue.Enqueue(new KeyValuePair <int, object>(failureMsg.MessageId, failureMsg));
                }
                goto BREAK_CONNECT;
            }
BREAK_CONNECT:
            lock (RecvQueue)
            {
                if (State == ConnectionState.Established)
                {
                    State = ConnectionState.Closed;
                    var vMsg = new CCMSGConnectionBreak();
                    RecvQueue.Enqueue(new KeyValuePair <int, object>(vMsg.MessageId, vMsg));
                }
            }
        }