Skip to content

Commit 3f131d7

Browse files
committed
Check for dead clients while checking for available messages
1 parent 10727da commit 3f131d7

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

java/libraries/net/src/processing/net/Server.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,16 @@ public Client available() {
220220
for (int i = 0; i < clientCount; i++) {
221221
int which = (index + i) % clientCount;
222222
Client client = clients[which];
223+
//Check for valid client
224+
if (!client.active()){
225+
removeIndex(which); //Remove dead client
226+
i--; //Don't skip the next client
227+
//If the client has data make sure lastAvailable
228+
//doesn't end up skipping the next client
229+
which--;
230+
//fall through to allow data from dead clients
231+
//to be retreived.
232+
}
223233
if (client.available() > 0) {
224234
lastAvailable = which;
225235
return client;

0 commit comments

Comments
 (0)