Skip to content

Commit f34f84b

Browse files
author
Eric Wilkison
committed
Fix add multiple services
1 parent d45294e commit f34f84b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

libraries/ESP8266mDNS/ESP8266mDNS.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,13 @@ void MDNSResponder::addService(char *name, char *proto, uint16_t port){
146146
os_strcpy(srv->_proto, proto);
147147
srv->_port = port;
148148
srv->_next = 0;
149-
if(_services) _services->_next = srv;
150-
else _services = srv;
149+
150+
if(_services == 0) _services = srv;
151+
else{
152+
MDNSService* servicePtr = _services;
153+
while(servicePtr->_next !=0) servicePtr = servicePtr->_next;
154+
servicePtr->_next = srv;
155+
}
151156
}
152157

153158
uint16_t MDNSResponder::_getServicePort(char *name, char *proto){

0 commit comments

Comments
 (0)