Example #1
0
 protected void AlertClose()
 {
     StatusConnection = StatusConection.Close;
     _acsHandle       = 0;
     _invokeId        = 0;
     OnClosedEvent?.Invoke(this, null);
 }
Example #2
0
 public void CloseStream()
 {
     Log.DebugFormat("{0} : Close stream ", LinkName);
     StatusConnection = StatusConection.Close;
     if (_acsHandle != 0)
     {
         CreateTask <object>((key, pd) => NativeMethods.acsCloseStream(AcsHandle, key, ref pd));
     }
 }
Example #3
0
        public void AbortStream()
        {
            Log.DebugFormat("{0} : Abort stream ", LinkName);
            StatusConnection = StatusConection.Close;
            if (_acsHandle != 0)
            {
                var pd = new PrivateData_t();
                NativeMethods.acsAbortStream(AcsHandle, ref pd);

                /*if (ret != ACSFunctionRet_t.ACSPOSITIVE_ACK)
                 * {
                 *  throw new Exeption("AbortStream", ret);
                 * }*/
            }
            AlertClose();
        }
Example #4
0
        protected void Acsconfirmation(ACSConfirmationEvent data, eventTypeACS eventType)
        {
            switch (eventType)
            {
            case eventTypeACS.ACS_ABORT_STREAM:
                AlertClose();
                break;

            case eventTypeACS.ACS_CLOSE_STREAM_CONF:
                AlertClose();
                break;

            case eventTypeACS.ACS_OPEN_STREAM_CONF:
                OnConnnectedEvent?.Invoke(this, null);
                CbTaskNew.Set(data.invokeID, new NullTsapiReturn());
                StatusConnection = StatusConection.Open;
                _waitClient.Set();
                break;

            case eventTypeACS.ACS_UNIVERSAL_FAILURE_CONF:
                if (OnUniversalFailureEvent != null)
                {
                    OnUniversalFailureSysEvent?.Invoke(this,
                                                       new UniversalFailureSys {
                        Error = data.failureEvent.error, EventType = eventType
                    });
                }
                CbTaskNew.Clear();
                AnalizeFailurs(data.failureEvent.error);
                break;

            default:
                Log.Error($"{LinkName} : Error ACSCONFIRMATION  ",
                          new ProgrammingExeption($"Не обработан event '{eventType}' в ACSCONFIRMATION"));
                throw new ProgrammingExeption($"Не обработан event '{eventType}' в ACSCONFIRMATION");
            }
        }