Skip to content

Commit bc8c95f

Browse files
authored
Merge pull request #685 from liamcottle/fix/wifi-companion-clients
WiFi Companion: always accept new connections
2 parents 4785240 + 796b4c7 commit bc8c95f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/helpers/esp32/SerialWifiInterface.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,18 @@ bool SerialWifiInterface::isWriteBusy() const {
4444
}
4545

4646
size_t SerialWifiInterface::checkRecvFrame(uint8_t dest[]) {
47-
if (!client) client = server.available();
47+
// check if new client connected
48+
auto newClient = server.available();
49+
if (newClient) {
50+
51+
// disconnect existing client
52+
deviceConnected = false;
53+
client.stop();
54+
55+
// switch active connection to new client
56+
client = newClient;
57+
58+
}
4859

4960
if (client.connected()) {
5061
if (!deviceConnected) {

0 commit comments

Comments
 (0)