Exemplo n.º 1
0
 protected void AbandonStartedUnits()
 {
     if (IsBusy)
     {
         AsciiProtocolUnit.FireFinished(_currentUnit);
     }
     while (_unitQueue.Count > 0)
     {
         AsciiProtocolUnit.FireFinished((AsciiProtocolUnit)_unitQueue.Pop());
     }
 }
Exemplo n.º 2
0
 public virtual void StartUnit(int priority, AsciiProtocolUnit unit)
 {
     if (!Core.NetworkAP.IsOwnerThread)
     {
         Core.NetworkAP.QueueJob(JobPriority.Immediate, _startDelegate, priority, unit);
     }
     else
     {
         _unitQueue.Push(priority, unit);
         if (!IsBusy)
         {
             StartNextUnitAsync();
         }
     }
 }
Exemplo n.º 3
0
        private void sendUnit_Finished(AsciiProtocolUnit unit)
        {
            AsciiSendLineUnit sendUnit = (AsciiSendLineUnit)unit;

            if (!(_lineSent = sendUnit.LineSent))
            {
                FireFinished();
            }
            else
            {
                _connection.AfterReceive    += new MethodInvoker(_connection_AfterReceive);
                _connection.LineReceived    += new LineDelegate(_connection_LineReceived);
                _connection.OperationFailed += new MethodInvoker(FireFinished);
                _connection.SkipReceivedStream();
                _connection.Receive();
            }
        }
Exemplo n.º 4
0
        private void connectUnit_Finished(AsciiProtocolUnit unit)
        {
            AsciiConnectUnit connectUnit = (AsciiConnectUnit)unit;

            if (!(_connected = connectUnit.Connected))
            {
                FireFinished();
            }
            else
            {
                _connection.AfterReceive    += new MethodInvoker(FireFinished);
                _connection.LineReceived    += new LineDelegate(_connection_LineReceived);
                _connection.OperationFailed += new MethodInvoker(FireFinished);
                _connection.SkipReceivedStream();
                _connection.Receive();
            }
        }
Exemplo n.º 5
0
 private void StartNextUnit()
 {
     if (!Core.NetworkAP.IsOwnerThread)
     {
         StartNextUnitAsync();
     }
     else
     {
         if (_unitQueue.Count > 0)
         {
             AsciiProtocolUnit unit = (AsciiProtocolUnit)_unitQueue.Pop();
             unit.Finished += new AsciiProtocolUnitDelegate(unit_Finished);
             _currentUnit   = unit;
             if (LastSocketException == null)
             {
                 unit.Start(this);
             }
             else
             {
                 Close();
             }
         }
     }
 }
Exemplo n.º 6
0
 protected internal static void FireFinished(AsciiProtocolUnit unit)
 {
     unit.FireFinished();
 }
Exemplo n.º 7
0
 protected static void StartUnit(AsciiProtocolUnit unit, AsciiTcpConnection connection)
 {
     unit.Start(connection);
 }
Exemplo n.º 8
0
 private void unit_Finished(AsciiProtocolUnit unit)
 {
     _currentUnit = null;
     CloseIdleConnectionAfterTimeout();
     StartNextUnitAsync();
 }