1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-06 05:21:22 +03:00

Fix begin overwriting instancename

This commit is contained in:
Eric Wilkison 2015-12-17 14:29:15 -08:00
parent 99b3e2df26
commit f7d8a027e8

View File

@ -85,7 +85,10 @@ static const IPAddress MDNS_MULTICAST_ADDR(224, 0, 0, 251);
static const int MDNS_MULTICAST_TTL = 1; static const int MDNS_MULTICAST_TTL = 1;
static const int MDNS_PORT = 5353; static const int MDNS_PORT = 5353;
MDNSResponder::MDNSResponder() : _conn(0) { _services = 0; } MDNSResponder::MDNSResponder() : _conn(0) {
_services = 0;
_instanceName[0] = 0;
}
MDNSResponder::~MDNSResponder() {} MDNSResponder::~MDNSResponder() {}
bool MDNSResponder::begin(const char* hostname){ bool MDNSResponder::begin(const char* hostname){
@ -101,8 +104,8 @@ bool MDNSResponder::begin(const char* hostname){
_hostName[i] = tolower(hostname[i]); _hostName[i] = tolower(hostname[i]);
_hostName[n] = '\0'; _hostName[n] = '\0';
// Copy hostname to default instance name // If instance name is not already set copy hostname to instance name
os_strcpy(_instanceName,hostname); if (os_strlen(_instanceName) == 0) os_strcpy(_instanceName,hostname);
// Open the MDNS socket if it isn't already open. // Open the MDNS socket if it isn't already open.
if (!_conn) { if (!_conn) {