From b8dfc6b1b5db4a021a9480101e0961ed71e283e5 Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Thu, 28 Mar 2019 15:29:08 +0100 Subject: [PATCH] Change order of evaluation Change order of evaluation --- sonoff/xplg_wemohue.ino | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sonoff/xplg_wemohue.ino b/sonoff/xplg_wemohue.ino index 51e51f84b..0dfcc2f5d 100644 --- a/sonoff/xplg_wemohue.ino +++ b/sonoff/xplg_wemohue.ino @@ -197,6 +197,7 @@ void HueRespondToMSearch(void) bool UdpDisconnect(void) { if (udp_connected) { + PortUdp.flush(); WiFiUDP::stopAll(); AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_MULTICAST_DISABLED)); udp_connected = false; @@ -232,7 +233,7 @@ void PollUdp(void) AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("UDP: Packet (%d)"), len); // AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("\n%s"), packet_buffer); - if ((strstr_P(packet_buffer, PSTR("M-SEARCH")) != nullptr) && !udp_response_mutex && devices_present) { + if (devices_present && !udp_response_mutex && (strstr_P(packet_buffer, PSTR("M-SEARCH")) != nullptr)) { udp_response_mutex = true; udp_remote_ip = PortUdp.remoteIP();