mirror of
https://github.com/esp8266/Arduino.git
synced 2025-07-27 18:02:17 +03:00
-replace char _hostName[63], char _instanceName[63], and char _txt[128] with Strings. Calling enableArduino allocates four TXT records, and there is quite an overhead of storing tcp_check=no inside an 128-byte buffer. Plus you gain flexibility by supporting TXT records larger than 128 bytes. Host and instance names should also be less than 63 characters most of the time.\n-move definitions of struct MDNSService and struct MDNSTxt to .cpp file, and use forward declaratio
This commit is contained in:
@ -52,19 +52,8 @@ License (MIT license):
|
||||
|
||||
class UdpContext;
|
||||
|
||||
struct MDNSService {
|
||||
MDNSService* _next;
|
||||
char _name[32];
|
||||
char _proto[3];
|
||||
uint16_t _port;
|
||||
struct MDNSTxt * _txts;
|
||||
uint16_t _txtLen; // length of all txts
|
||||
};
|
||||
|
||||
struct MDNSTxt{
|
||||
MDNSTxt * _next;
|
||||
char _txt[128];
|
||||
};
|
||||
struct MDNSService;
|
||||
struct MDNSTxt;
|
||||
|
||||
class MDNSResponder {
|
||||
public:
|
||||
@ -95,19 +84,19 @@ public:
|
||||
|
||||
void enableArduino(uint16_t port, bool auth=false);
|
||||
|
||||
void setInstanceName(char * name);
|
||||
void setInstanceName(String name);
|
||||
void setInstanceName(const char * name){
|
||||
setInstanceName((char*) name);
|
||||
setInstanceName(String(name));
|
||||
}
|
||||
void setInstanceName(String name){
|
||||
setInstanceName(name.c_str());
|
||||
void setInstanceName(char * name){
|
||||
setInstanceName(String(name));
|
||||
}
|
||||
|
||||
private:
|
||||
struct MDNSService * _services;
|
||||
UdpContext* _conn;
|
||||
char _hostName[63];
|
||||
char _instanceName[63];
|
||||
String _hostName;
|
||||
String _instanceName;
|
||||
|
||||
uint32_t _getOurIp();
|
||||
uint16_t _getServicePort(char *service, char *proto);
|
||||
|
Reference in New Issue
Block a user