mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-28 13:16:32 +00:00
Merge pull request #11373 from barbudor/alternative_syslog_dns_fix
Alternative syslog dns fix
This commit is contained in:
commit
3d3c77972d
@ -2137,8 +2137,16 @@ void SyslogAsync(bool refresh) {
|
|||||||
if (mxtime > 0) {
|
if (mxtime > 0) {
|
||||||
uint32_t current_hash = GetHash(SettingsText(SET_SYSLOG_HOST), strlen(SettingsText(SET_SYSLOG_HOST)));
|
uint32_t current_hash = GetHash(SettingsText(SET_SYSLOG_HOST), strlen(SettingsText(SET_SYSLOG_HOST)));
|
||||||
if (syslog_host_hash != current_hash) {
|
if (syslog_host_hash != current_hash) {
|
||||||
|
IPAddress temp_syslog_host_addr;
|
||||||
|
int ok = WiFi.hostByName(SettingsText(SET_SYSLOG_HOST), temp_syslog_host_addr); // If sleep enabled this might result in exception so try to do it once using hash
|
||||||
|
if (!ok || (0xFFFFFFFF == (uint32_t)temp_syslog_host_addr)) { // 255.255.255.255 is assumed a DNS problem
|
||||||
|
TasmotaGlobal.syslog_level = 0;
|
||||||
|
TasmotaGlobal.syslog_timer = SYSLOG_TIMER;
|
||||||
|
AddLog(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION "Loghost DNS resolve failed (%s). " D_RETRY_IN " %d " D_UNIT_SECOND), SettingsText(SET_SYSLOG_HOST), SYSLOG_TIMER);
|
||||||
|
return;
|
||||||
|
}
|
||||||
syslog_host_hash = current_hash;
|
syslog_host_hash = current_hash;
|
||||||
WiFi.hostByName(SettingsText(SET_SYSLOG_HOST), syslog_host_addr); // If sleep enabled this might result in exception so try to do it once using hash
|
syslog_host_addr = temp_syslog_host_addr;
|
||||||
}
|
}
|
||||||
if (!PortUdp.beginPacket(syslog_host_addr, Settings.syslog_port)) {
|
if (!PortUdp.beginPacket(syslog_host_addr, Settings.syslog_port)) {
|
||||||
TasmotaGlobal.syslog_level = 0;
|
TasmotaGlobal.syslog_level = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user