Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions MDNS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ int MDNS::startDiscoveringService(const char* serviceName,
unsigned long timeout)
{
this->stopDiscoveringService();
char* n = (char*)my_malloc(strlen(serviceName) + 13);

char* n = (char*)my_malloc(strlen(serviceName));
if (NULL == n)
return 0;

Expand Down Expand Up @@ -323,9 +323,6 @@ MDNSError_t MDNS::_sendMDNSMessage(uint32_t /*peerAddress*/, uint32_t xid, int t
break;
}




this->_udp->beginPacket(mdnsMulticastIPAddr,MDNS_SERVER_PORT);
this->_udp->write((uint8_t*)dnsHeader,sizeof(DNSHeader_t));

Expand Down Expand Up @@ -456,9 +453,10 @@ MDNSError_t MDNS::_sendMDNSMessage(uint32_t /*peerAddress*/, uint32_t xid, int t
buf[1] = (type == MDNSPacketTypeServiceQuery) ? 0x0c : 0x01;
buf[3] = 0x1;

this->_udp->write((uint8_t*)buf, sizeof(DNSHeader_t));
ptr += sizeof(DNSHeader_t);

this->_udp->write((uint8_t*)buf, 4);
// ptr += sizeof(DNSHeader_t);
ptr += 4;

this->_resolveLastSendMillis[(type == MDNSPacketTypeServiceQuery) ? 1 : 0] = millis();

break;
Expand Down Expand Up @@ -1253,8 +1251,11 @@ void MDNS::removeAllServiceRecords()
this->_removeServiceRecord(i);
}

void MDNS::_writeDNSName(const uint8_t* name, uint16_t* pPtr,
uint8_t* buf, int bufSize, int zeroTerminate)
void MDNS::_writeDNSName(const uint8_t* name,
uint16_t* pPtr,
uint8_t* buf,
int bufSize,
int zeroTerminate)
{
uint16_t ptr = *pPtr;
uint8_t* p1 = (uint8_t*)name, *p2, *p3;
Expand Down