Example #1
0
    private void ReceiveCallback(IAsyncResult iasyncResult_0)
    {
        NetworkStream asyncState = (NetworkStream)iasyncResult_0.AsyncState;

        try
        {
            int num = asyncState.EndRead(iasyncResult_0);
            if (num == 0)
            {
                base.method_0(asyncState, true);
            }
            else
            {
                this.class5_0.method_7(num);
                for (string str = this.class5_0.kjfPdghQbi(); str != null; str = this.class5_0.kjfPdghQbi())
                {
                    IHeader4           interface2 = null;
                    MessageInvalidType valid      = MessageInvalidType.Valid;
                    if (!this.object_5.imethod_12(str))
                    {
                        valid = MessageInvalidType.InvalidToken;
                    }
                    else
                    {
                        interface2 = this.object_5.imethod_11(str);
                        if (interface2 == null)
                        {
                            valid = MessageInvalidType.InvalidHeader;
                        }
                    }
                    if (valid != MessageInvalidType.Valid)
                    {
                        goto Label_00DF;
                    }
                    IMessageHandler interface3 = new Message1(interface2, str, base.ipendPoint_0);
                    base.AsynHandleMessage(interface3);
                }
                asyncState.BeginRead(this.class5_0.method_4(), this.class5_0.method_5(), this.class5_0.method_6(), new AsyncCallback(this.ReceiveCallback), asyncState);
            }
            return;

Label_00DF:
            base.OnInvalidMessageReceived(base.ipendPoint_0, MessageInvalidType.InvalidHeader);
            asyncState.Close();
            base.method_0(asyncState, false);
        }
        catch (Exception exception)
        {
            if ((exception is IOException) || (exception is ObjectDisposedException))
            {
                base.method_0(asyncState, true);
            }
            else if (!base.imethod_16())
            {
                base.emptyAgileLogger_0.Log(exception, "CJFramework.Engine.Tcp.Passive.PassiveTextTcpEngine.ReceiveCallback", ErrorLevel.High);
            }
        }
    }
Example #2
0
 public Class29(IPEndPoint ipendPoint_1, MessageInvalidType messageInvalidType_1)
 {
     this.ipendPoint_0 = ipendPoint_1;
     this.messageInvalidType_0 = messageInvalidType_1;
     if (messageInvalidType_1 == MessageInvalidType.Valid)
     {
         throw new Exception("The Ctor just support Invalid Message !");
     }
 }
Example #3
0
    private void ReceiveCallback(IAsyncResult iasyncResult_0)
    {
        NetworkStream asyncState = (NetworkStream)iasyncResult_0.AsyncState;

        try
        {
            int offset = asyncState.EndRead(iasyncResult_0);
            if (offset == 0)
            {
                base.method_0(asyncState, true);
            }
            else
            {
                int num2 = this.interface46_0.imethod_9();
                NetworkHelper.ReceiveData(asyncState, this.LvFuuIfhcm, offset, num2 - offset);
                Interface22 interface2 = this.interface46_0.imethod_10(this.LvFuuIfhcm, 0);
                if (((interface2 == null) || (interface2.imethod_2() != this.interface46_0.imethod_8())) || ((num2 + interface2.imethod_5()) > base.imethod_9()))
                {
                    MessageInvalidType invalidHeader = MessageInvalidType.InvalidHeader;
                    if (interface2 != null)
                    {
                        invalidHeader = (interface2.imethod_2() == this.interface46_0.imethod_8()) ? MessageInvalidType.MessageSizeOverflow : MessageInvalidType.InvalidToken;
                    }
                    base.OnInvalidMessageReceived(base.ipendPoint_0, invalidHeader);
                    asyncState.Close();
                    base.method_0(asyncState, false);
                }
                else
                {
                    byte[] buffer = null;
                    if (interface2.imethod_5() > 0)
                    {
                        buffer = NetworkHelper.ReceiveData(asyncState, interface2.imethod_5());
                    }
                    MessageHandler class2 = new MessageHandler(interface2, buffer, 0, base.ipendPoint_0);
                    base.AsynHandleMessage(class2);
                    asyncState.BeginRead(this.LvFuuIfhcm, 0, this.LvFuuIfhcm.Length, new AsyncCallback(this.ReceiveCallback), asyncState);
                }
            }
        }
        catch (Exception exception)
        {
            if ((exception is IOException) || (exception is ObjectDisposedException))
            {
                base.method_0(asyncState, true);
            }
            else if (!base.imethod_16())
            {
                base.emptyAgileLogger_0.Log(exception, "CJFramework.Engine.Tcp.Passive.PassiveStreamTcpEngine.ReceiveCallback", ErrorLevel.High);
            }
        }
    }
Example #4
0
    private MessageHandler EndReadOneMessage(IAsyncResult iasyncResult_0)
    {
        Class7 asyncState = (Class7)iasyncResult_0.AsyncState;
        int    offset     = asyncState.GetStream().EndRead(iasyncResult_0);

        if (offset <= 0)
        {
            base.OnSomeOneDisconnected(asyncState, DisconnectedType.NetworkInterrupted);
            return(null);
        }
        int num2 = this.interface46_0.imethod_9();
        int size = num2 - offset;

        NetworkHelper.ReceiveData(asyncState.GetStream(), asyncState.method_4(), offset, size);
        base.method_2(asyncState, asyncState.method_4());
        Interface22 interface2 = this.interface46_0.imethod_10(asyncState.method_4(), 0);

        if (((interface2 == null) || (interface2.imethod_2() != this.interface46_0.imethod_8())) || ((num2 + interface2.imethod_5()) > base.imethod_9()))
        {
            MessageInvalidType invalidHeader = MessageInvalidType.InvalidHeader;
            if (interface2 != null)
            {
                invalidHeader = (interface2.imethod_2() == this.interface46_0.imethod_8()) ? MessageInvalidType.MessageSizeOverflow : MessageInvalidType.InvalidToken;
            }
            base.OnSomeOneDisconnected(asyncState, DisconnectedType.InvalidMessage);
            base.emptyAgileLogger_0.Log("ErrorMessage", string.Format("Source Address:{0} ,MessageInvalidType:{1}", asyncState.GetIPEndPoint(), invalidHeader), "CJFramework.Engine.Tcp.Server.StreamTcpEngine.EndReadOneMessage", ErrorLevel.Standard);
            base.OnInvalidMessageReceived(asyncState.GetIPEndPoint(), invalidHeader);
            return(null);
        }
        byte[] buffer = null;
        if (interface2.imethod_5() > 0)
        {
            if (interface2.imethod_5() > base.imethod_9())
            {
                string msg = string.Format("MessageBodyLength [{0}] exceed the MaxMessageSize! Source address : {1}.", interface2.imethod_5(), asyncState.GetIPEndPoint());
                base.emptyAgileLogger_0.Log("MessageSizeOverflow", msg, "CJFramework.Tcp.Server.StreamTcpEngine.EndReadOneMessage", ErrorLevel.Standard);
                base.OnSomeOneDisconnected(asyncState, DisconnectedType.InvalidMessage);
                return(null);
            }
            buffer = NetworkHelper.ReceiveData(asyncState.GetStream(), interface2.imethod_5());
        }
        return(new MessageHandler(interface2, buffer, 0, asyncState.GetIPEndPoint()));
    }
Example #5
0
 public void method_5(MessageInvalidType messageInvalidType_1)
 {
     this.messageInvalidType_0 = messageInvalidType_1;
 }
Example #6
0
 public Class29(IPEndPoint ipendPoint_1, IMessageHandler interface37_1)
 {
     this.messageInvalidType_0 = MessageInvalidType.Valid;
     this.ipendPoint_0 = ipendPoint_1;
     this.interface37_0 = interface37_1;
 }
Example #7
0
 protected void OnInvalidMessageReceived(IPEndPoint ipendPoint_0, MessageInvalidType messageInvalidType_0)
 {
     this.eventSafeTrigger_0.Action <IPEndPoint, MessageInvalidType>("InvalidMessageReceived", this.InvalidMessageReceived, ipendPoint_0, messageInvalidType_0);
 }
Example #8
0
 private void method_6(IPEndPoint ipendPoint_0, MessageInvalidType messageInvalidType_0)
 {
     this.iagileLogger_0.LogWithTime(string.Format("TcpPassiveEngine Invalid Message Received. Invalid Type:{0}", messageInvalidType_0));
 }
Example #9
0
 protected void OnInvalidMessageReceived(IPEndPoint ipendPoint_1, MessageInvalidType messageInvalidType_0)
 {
     this.EodfwttmVK.Action <IPEndPoint, MessageInvalidType>("InvalidMessageReceived", this.InvalidMessageReceived, ipendPoint_1, messageInvalidType_0);
 }