Exemple #1
0
        public int GetWriteQueueSize(byte netIfIndex)
        {
            LinkDriver p = GetLinkDriver(netIfIndex);

            if (p != null)
            {
                return(p.GetWriteQueueSize());
            }
            return(-1);
        }
Exemple #2
0
            public void Run()
            {
                uint lastResponseCheckTime = Primitives.GetBabelMilliTicker();

                for (; ;)
                {
                    if (!Master.Started)
                    {
                        break;
                    }
                    try {
                        uint curTime = Primitives.GetBabelMilliTicker();
                        if (LnkPrt.HasTasks && (LnkPrt.NumTasks > 0))
                        {
                            LnkPrt.ServiceTasks(curTime, LinkTaskKind.Service);
                        }
                        if (LnkPrt.DoesIO)
                        {
                            if ((curTime - lastResponseCheckTime) > LnkPrt.ResponseInterval)
                            {
                                lastResponseCheckTime = curTime;
                                if (LnkPrt.HasRead)
                                {
                                    LnkPrt.HasRead = false;
                                    if (LnkPrt.IoNetIfDevice.GetComponentState() == ComponentState.Unresponsive)
                                    {
                                        LnkPrt.IoNetIfDevice.NotifyStateChange(ComponentState.Working);
                                    }
                                }
                                else if (LnkPrt.IoNetIfDevice.GetComponentState() == ComponentState.Working)
                                {
                                    LnkPrt.IoNetIfDevice.NotifyStateChange(ComponentState.Unresponsive);
                                }
                            }
                            if (LnkPrt.IoNetIfDevice.HasHeartBeat())
                            {
                                if (LnkPrt.GetWriteQueueSize() == 0)
                                {
                                    LnkPrt.LinkPing();
                                }
                            }
                            if (LnkPrt.LinkMissingQueue.Size() != 0)
                            {
                                LnkPrt.Monitor.LinkProtocol();
                            }
                        }
                        Thread.Sleep(LnkPrt.SchedulerInterval);
                    } catch (ThreadInterruptedException) {
                        break;
                    } catch (Exception) {
                    }
                }
            }
Exemple #3
0
        // Returns true if message sent successfully.
        // Returns false if low level write Q count above water mark.
        // If connection dies during a long xfer, abort & return false.
        public bool DispatchMessage(MessageBinder binder)
        {
            if (PostNetIfIndex == ProtocolConstants.NETIF_UNSET)
            {
                OutgoingNetIfIndex = ProtocolConstants.NETIF_USER_BASE;
            }
            else
            {
                OutgoingNetIfIndex = PostNetIfIndex;
            }
            LinkDriver p = Exchange.Manager.GetLinkDriver(OutgoingNetIfIndex);

            if (p == null)
            {
                LastError = MessageError.BadNetIf;
                return(false);
            }
            if (p.GetWriteQueueSize() > p.LinkWriteQWaterMark)
            {
                return(false);
            }
            if (p.GetComponentState() != ComponentState.Working)
            {
                return(false);
            }

            if (binder.Message.SenderId != 0)
            {
                binder.Exchange.SubmitWaiter(binder);
            }
            while (HasRemainingTransfers())
            {
                ;
            }
            return(true);
        }