Skip to content

Commit

Permalink
AT server.available fix
Browse files Browse the repository at this point in the history
- don't return clients of other servers
    this was a major error
- only return clients with data available
    it is how server.available should work
- accept all waiting clients (up to max)
    because not all of them may have data available
    and we may want to server.print to all
  • Loading branch information
JAndrassy committed Sep 20, 2023
1 parent 65101b8 commit c78078e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions UNOR4USBBridge/cmds_wifi_netif.h
Original file line number Diff line number Diff line change
Expand Up @@ -488,8 +488,9 @@ void CAtHandler::add_cmds_wifi_netif() {
for(int i = 0;i<MAX_CLIENT_AVAILABLE;i++) {
if(!serverClients[i].client) {
serverClients[i].client = serverWiFi[sock]->available();
if(!serverClients[i].client)
break;
serverClients[i].server = sock;
break;
}
}

Expand All @@ -498,7 +499,9 @@ void CAtHandler::add_cmds_wifi_netif() {
int end = last_server_client_sock;

do {
if(serverClients[last_server_client_sock].client) {
if(serverClients[last_server_client_sock].client
&& serverClients[last_server_client_sock].server == sock
&& serverClients[last_server_client_sock].client.available() > 0) {
client_sock = last_server_client_sock;
break;
}
Expand Down

0 comments on commit c78078e

Please sign in to comment.