1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-25 20:02:37 +03:00

mDNS timeout: use real type (#8394)

This commit is contained in:
david gauchard 2021-12-02 23:38:35 +01:00 committed by GitHub
parent 26103a5827
commit d18cbfb07d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View File

@ -1030,6 +1030,8 @@ protected:
esp8266::polledTimeout::oneShotMs m_TTLTimeout;
timeoutLevel_t m_timeoutLevel;
using timeoutBase = decltype(m_TTLTimeout);
stcTTL(void);
bool set(uint32_t p_u32TTL);
@ -1039,7 +1041,7 @@ protected:
bool prepareDeletion(void);
bool finalTimeoutLevel(void) const;
unsigned long timeout(void) const;
timeoutBase::timeType timeout(void) const;
};
#ifdef MDNS_IP4_SUPPORT
/**

View File

@ -1663,22 +1663,19 @@ bool MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcTTL::finalTimeoutLevel(vo
/*
MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcTTL::timeout
*/
unsigned long MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcTTL::timeout(void) const
MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcTTL::timeoutBase::timeType MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcTTL::timeout(void) const
{
unsigned long timeout = esp8266::polledTimeout::oneShotMs::neverExpires;
if (TIMEOUTLEVEL_BASE == m_timeoutLevel) // 80%
{
timeout = (m_u32TTL * 800L); // to milliseconds
return (m_u32TTL * 800L); // to milliseconds
}
else if ((TIMEOUTLEVEL_BASE < m_timeoutLevel) && // >80% AND
(TIMEOUTLEVEL_FINAL >= m_timeoutLevel)) // <= 100%
{
timeout = (m_u32TTL * 50L);
return (m_u32TTL * 50L);
} // else: invalid
return timeout;
return MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcTTL::timeoutBase::neverExpires;
}