Ejemplo n.º 1
0
        internal void sendPing(RTAddress address)
        {
            var ping = new msg.Ping {
                address = address
            };

            var whichService = m_rand.Next(m_otherServices.Count);

            s_mgr.send(address, m_otherServices[whichService], ping);
        }
Ejemplo n.º 2
0
        void handle(msg.Ping ping)
        {
            ++m_pingsRecvd;

            var ts = DateTime.Now - m_lastLoggedPing;

            if (ts.TotalSeconds > 1.0)
            {
                log.debug($"{(uint)id & 0xffff:X4} got {m_pingsRecvd} Pings in {ts.TotalSeconds} seconds");

                m_lastLoggedPing = DateTime.Now;
                m_pingsRecvd     = 0;
            }

            //log.debug( $"{(uint)id & 0xffff:X4}  got Ping from {ping.address}" );

            var address = new RTAddress(s_mgr.Id, id);

            /*
             * if( address != ping.address && !m_otherServices.Contains(ping.address) )
             * {
             *      log.debug( $"{(uint)id & 0xffff:X4}  PING adding service {ping.address}" );
             *      m_otherServices = m_otherServices.Add( ping.address );
             * }
             */

            var tsFullTest = DateTime.Now - m_startPingTest;

            if (tsFullTest.TotalSeconds < cfg.res.testPingSec)
            {
                sendPing(address);
            }
            else
            {
                log.info($"Finished doing Ping tests.");
            }
        }