xp-framework/networking

Select(60, 0) failed

thekid opened this issue · 2 comments

Using the new peer.ServerSocket from 9.2.0; after a period of 60 seconds of inactivity:

image

What makes me suspicious is the warning stream_select(): No stream arrays were passed...

$read= [$this->socket->getHandle()];

// Check to see if there are sockets with data on it.
do {
  $n= $sockets->select0($read, $null, $null, $timeout);
} while (0 === $n);

This will happen because $read is modified; it should be copied before!

Changed not by copying but by changing the implementation to run housekeeping after timeout; which is a change for the better anyway; and fixes this bug.