Пример #1
0
        void ProcessAsyncPdu(SmppAsyncObject AsyncObject, SmppAsyncObject.SmppAsyncCompleted CompletionReason)
        {
            try {
                Exception exception = null;
                object    obj2      = null;
                FindAndRemoveTransaction(AsyncObject);
                switch (CompletionReason)
                {
                case SmppAsyncObject.SmppAsyncCompleted.Response: {
                    var header = new SmppHeader(AsyncObject.PduRes);
                    if (header.CommandId != -2147483648)
                    {
                        break;
                    }
                    exception = new SmppGenericNackException();
                    goto Label_008E;
                }

                case SmppAsyncObject.SmppAsyncCompleted.Timeout:
                    exception = new SmppTimeOutException();
                    Interlocked.Increment(ref ConsecutiveTimeouts);
                    if (ConsecutiveTimeouts > Settings.WindowSize)
                    {
                        BeginUnBind();
                    }
                    goto Label_008E;

                case SmppAsyncObject.SmppAsyncCompleted.Disconnection:
                    exception = new SmppInvalidConnectionStateException();
                    goto Label_008E;

                default:
                    goto Label_008E;
                }
                obj2 = new SmppSubmitSmRes(AsyncObject.PduRes);
                ConsecutiveTimeouts = 0;
Label_008E:
                switch (AsyncObject.Request.Header.CommandId)
                {
                case 3: {
                    var args3 = new SmppAsyncQuerySmResEventArgs();
                    args3._State            = AsyncObject.State;
                    args3._ProcessException = exception;
                    args3._RequestPdu       = AsyncObject.Request as SmppQuerySmReq;
                    args3._ResponsePdu      = obj2 as SmppQuerySmRes;
                    var handler3 = AsyncObject.Callback as SmppQuerySmResHandler;
                    handler3(this, args3);
                    return;
                }

                case 4: {
                    var args = new SmppAsyncSubmitSmResEventArgs();
                    args._State            = AsyncObject.State;
                    args._ProcessException = exception;
                    args._RequestPdu       = AsyncObject.Request as SmppSubmitSmReq;
                    args._ResponsePdu      = obj2 as SmppSubmitSmRes;
                    var handler = AsyncObject.Callback as SmppSubmitSmResHandler;
                    handler(this, args);
                    return;
                }

                case 0x15:
                    break;

                default:
                    return;
                }
                var e = new SmppAsyncEnquireLinkResEventArgs();
                e._State            = AsyncObject.State;
                e._ProcessException = exception;
                e._RequestPdu       = AsyncObject.Request as SmppEnquireLinkReq;
                e._ResponsePdu      = obj2 as SmppEnquireLinkRes;
                var callback = AsyncObject.Callback as SmppAsyncEnquireLinkResHandler;
                callback(this, e);
            } catch (Exception exception2) {
                log.Error("Devshock: " + exception2);
            }
        }
Пример #2
0
    void ProcessAsyncPdu(SmppAsyncObject AsyncObject, SmppAsyncObject.SmppAsyncCompleted CompletionReason) {
      try {
        Exception exception = null;
        object obj2 = null;
        FindAndRemoveTransaction(AsyncObject);
        switch (CompletionReason) {
          case SmppAsyncObject.SmppAsyncCompleted.Response: {
            var header = new SmppHeader(AsyncObject.PduRes);
            if (header.CommandId != -2147483648)
              break;
            exception = new SmppGenericNackException();
            goto Label_008E;
          }
          case SmppAsyncObject.SmppAsyncCompleted.Timeout:
            exception = new SmppTimeOutException();
            Interlocked.Increment(ref ConsecutiveTimeouts);
            if (ConsecutiveTimeouts > Settings.WindowSize)
              BeginUnBind();
            goto Label_008E;

          case SmppAsyncObject.SmppAsyncCompleted.Disconnection:
            exception = new SmppInvalidConnectionStateException();
            goto Label_008E;

          default:
            goto Label_008E;
        }
        obj2 = new SmppSubmitSmRes(AsyncObject.PduRes);
        ConsecutiveTimeouts = 0;
        Label_008E:
        switch (AsyncObject.Request.Header.CommandId) {
          case 3: {
            var args3 = new SmppAsyncQuerySmResEventArgs();
            args3._State = AsyncObject.State;
            args3._ProcessException = exception;
            args3._RequestPdu = AsyncObject.Request as SmppQuerySmReq;
            args3._ResponsePdu = obj2 as SmppQuerySmRes;
            var handler3 = AsyncObject.Callback as SmppQuerySmResHandler;
            handler3(this, args3);
            return;
          }
          case 4: {
            var args = new SmppAsyncSubmitSmResEventArgs();
            args._State = AsyncObject.State;
            args._ProcessException = exception;
            args._RequestPdu = AsyncObject.Request as SmppSubmitSmReq;
            args._ResponsePdu = obj2 as SmppSubmitSmRes;
            var handler = AsyncObject.Callback as SmppSubmitSmResHandler;
            handler(this, args);
            return;
          }
          case 0x15:
            break;

          default:
            return;
        }
        var e = new SmppAsyncEnquireLinkResEventArgs();
        e._State = AsyncObject.State;
        e._ProcessException = exception;
        e._RequestPdu = AsyncObject.Request as SmppEnquireLinkReq;
        e._ResponsePdu = obj2 as SmppEnquireLinkRes;
        var callback = AsyncObject.Callback as SmppAsyncEnquireLinkResHandler;
        callback(this, e);
      } catch (Exception exception2) {
        log.Error("Devshock: " + exception2);
      }
    }