mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-24 19:42:27 +03:00
LEAmDNS Fixes 1.1 (#5619)
* Fixes 1.1 - Better separation of ESP wifi thread code from user thread code - Added a flag for 'update()'-less use (disabled by default) - The too fast updates for service queries are fixed - Switched fully to PolledTimeout; LEATimeFlag not needed anymore (BTW: a const 'expired()' method would be helpful) - The device should stay visible now even after the first TTL timeout - Improved service querying (queries five times now) * Update mDNS_Clock.ino Removed references to LEATimeFlag.h * Update mDNS_Clock.ino Styling
This commit is contained in:
@ -343,7 +343,8 @@ bool MDNSResponder::_sendMDNSServiceQuery(const MDNSResponder::stcMDNSServiceQue
|
||||
*
|
||||
*/
|
||||
bool MDNSResponder::_sendMDNSQuery(const MDNSResponder::stcMDNS_RRDomain& p_QueryDomain,
|
||||
uint16_t p_u16QueryType) {
|
||||
uint16_t p_u16QueryType,
|
||||
stcMDNSServiceQuery::stcAnswer* p_pKnownAnswers /*= 0*/) {
|
||||
|
||||
bool bResult = false;
|
||||
|
||||
@ -351,9 +352,12 @@ bool MDNSResponder::_sendMDNSQuery(const MDNSResponder::stcMDNS_RRDomain& p_Quer
|
||||
if (0 != ((sendParameter.m_pQuestions = new stcMDNS_RRQuestion))) {
|
||||
sendParameter.m_pQuestions->m_Header.m_Domain = p_QueryDomain;
|
||||
|
||||
sendParameter.m_pQuestions->m_bUnicast = true;
|
||||
sendParameter.m_pQuestions->m_Header.m_Attributes.m_u16Type = p_u16QueryType;
|
||||
sendParameter.m_pQuestions->m_Header.m_Attributes.m_u16Class = (0x8000 | DNS_RRCLASS_IN); // Unicast & INternet
|
||||
// It seems, that some mDNS implementations don't support 'unicast response' questions...
|
||||
sendParameter.m_pQuestions->m_Header.m_Attributes.m_u16Class = (/*0x8000 |*/ DNS_RRCLASS_IN); // /*Unicast &*/ INternet
|
||||
|
||||
// TODO: Add knwon answer to the query
|
||||
(void)p_pKnownAnswers;
|
||||
|
||||
bResult = _sendMDNSMessage(sendParameter);
|
||||
} // else: FAILED to alloc question
|
||||
@ -447,7 +451,7 @@ bool MDNSResponder::_readRRQuestion(MDNSResponder::stcMDNS_RRQuestion& p_rRRQues
|
||||
*
|
||||
*/
|
||||
bool MDNSResponder::_readRRAnswer(MDNSResponder::stcMDNS_RRAnswer*& p_rpRRAnswer) {
|
||||
DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _readRRAnswer\n")););
|
||||
//DEBUG_EX_INFO(DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _readRRAnswer\n")););
|
||||
|
||||
bool bResult = false;
|
||||
|
||||
@ -458,11 +462,11 @@ bool MDNSResponder::_readRRAnswer(MDNSResponder::stcMDNS_RRAnswer*& p_rpRRAnswer
|
||||
(_udpRead32(u32TTL)) &&
|
||||
(_udpRead16(u16RDLength))) {
|
||||
|
||||
DEBUG_EX_INFO(
|
||||
/*DEBUG_EX_INFO(
|
||||
DEBUG_OUTPUT.printf_P(PSTR("[MDNSResponder] _readRRAnswer: Reading 0x%04X answer (class:0x%04X, TTL:%u, RDLength:%u) for "), header.m_Attributes.m_u16Type, header.m_Attributes.m_u16Class, u32TTL, u16RDLength);
|
||||
_printRRDomain(header.m_Domain);
|
||||
DEBUG_OUTPUT.printf_P(PSTR("\n"));
|
||||
);
|
||||
);*/
|
||||
|
||||
switch (header.m_Attributes.m_u16Type & (~0x8000)) { // Topmost bit might carry 'cache flush' flag
|
||||
#ifdef MDNS_IP4_SUPPORT
|
||||
|
Reference in New Issue
Block a user