예제 #1
0
 protected void AbandonStartedUnits()
 {
     if (IsBusy)
     {
         AsciiProtocolUnit.FireFinished(_currentUnit);
     }
     while (_unitQueue.Count > 0)
     {
         AsciiProtocolUnit.FireFinished((AsciiProtocolUnit)_unitQueue.Pop());
     }
 }
예제 #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();
         }
     }
 }
예제 #3
0
파일: ProtocolUnits.cs 프로젝트: mo5h/omeo
        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();
            }
        }
예제 #4
0
파일: ProtocolUnits.cs 프로젝트: mo5h/omeo
        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();
            }
        }
예제 #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();
             }
         }
     }
 }
예제 #6
0
파일: ProtocolUnits.cs 프로젝트: mo5h/omeo
 protected internal static void FireFinished(AsciiProtocolUnit unit)
 {
     unit.FireFinished();
 }
예제 #7
0
파일: ProtocolUnits.cs 프로젝트: mo5h/omeo
 protected static void StartUnit(AsciiProtocolUnit unit, AsciiTcpConnection connection)
 {
     unit.Start(connection);
 }
예제 #8
0
 private void unit_Finished(AsciiProtocolUnit unit)
 {
     _currentUnit = null;
     CloseIdleConnectionAfterTimeout();
     StartNextUnitAsync();
 }