mirror of
https://github.com/processing/processing4.git
synced 2026-02-26 08:44:39 +01:00
Check for dead clients while checking for available messages
This commit is contained in:
@@ -220,6 +220,16 @@ public class Server implements Runnable {
|
||||
for (int i = 0; i < clientCount; i++) {
|
||||
int which = (index + i) % clientCount;
|
||||
Client client = clients[which];
|
||||
//Check for valid client
|
||||
if (!client.active()){
|
||||
removeIndex(which); //Remove dead client
|
||||
i--; //Don't skip the next client
|
||||
//If the client has data make sure lastAvailable
|
||||
//doesn't end up skipping the next client
|
||||
which--;
|
||||
//fall through to allow data from dead clients
|
||||
//to be retreived.
|
||||
}
|
||||
if (client.available() > 0) {
|
||||
lastAvailable = which;
|
||||
return client;
|
||||
|
||||
Reference in New Issue
Block a user