Skip to content

Commit d18cbfb

Browse files
authored
mDNS timeout: use real type (#8394)
1 parent 26103a5 commit d18cbfb

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

libraries/ESP8266mDNS/src/LEAmDNS.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,8 @@ class MDNSResponder
10301030
esp8266::polledTimeout::oneShotMs m_TTLTimeout;
10311031
timeoutLevel_t m_timeoutLevel;
10321032

1033+
using timeoutBase = decltype(m_TTLTimeout);
1034+
10331035
stcTTL(void);
10341036
bool set(uint32_t p_u32TTL);
10351037

@@ -1039,7 +1041,7 @@ class MDNSResponder
10391041
bool prepareDeletion(void);
10401042
bool finalTimeoutLevel(void) const;
10411043

1042-
unsigned long timeout(void) const;
1044+
timeoutBase::timeType timeout(void) const;
10431045
};
10441046
#ifdef MDNS_IP4_SUPPORT
10451047
/**

libraries/ESP8266mDNS/src/LEAmDNS_Structs.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -1663,22 +1663,19 @@ bool MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcTTL::finalTimeoutLevel(vo
16631663
/*
16641664
MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcTTL::timeout
16651665
*/
1666-
unsigned long MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcTTL::timeout(void) const
1666+
MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcTTL::timeoutBase::timeType MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcTTL::timeout(void) const
16671667
{
1668-
1669-
unsigned long timeout = esp8266::polledTimeout::oneShotMs::neverExpires;
1670-
16711668
if (TIMEOUTLEVEL_BASE == m_timeoutLevel) // 80%
16721669
{
1673-
timeout = (m_u32TTL * 800L); // to milliseconds
1670+
return (m_u32TTL * 800L); // to milliseconds
16741671
}
16751672
else if ((TIMEOUTLEVEL_BASE < m_timeoutLevel) && // >80% AND
16761673
(TIMEOUTLEVEL_FINAL >= m_timeoutLevel)) // <= 100%
16771674
{
16781675

1679-
timeout = (m_u32TTL * 50L);
1676+
return (m_u32TTL * 50L);
16801677
} // else: invalid
1681-
return timeout;
1678+
return MDNSResponder::stcMDNSServiceQuery::stcAnswer::stcTTL::timeoutBase::neverExpires;
16821679
}
16831680

16841681

0 commit comments

Comments
 (0)