diff --git a/app/Console/Commands/Server.php b/app/Console/Commands/Server.php index 1d2f47b..8810b35 100644 --- a/app/Console/Commands/Server.php +++ b/app/Console/Commands/Server.php @@ -131,6 +131,11 @@ class Server extends Command // Read a character from the client session $read = $client->read(1); + // It appears that read will return '' instead of false when a disconnect has occurred. + // We'll set it to NULL so its caught later + if ($read === '') + $read = NULL; + if ($read != '') { dump(sprintf('Mode: [%s] CMD: [%s] frame: [%s] Received [%s (%s)]', $mode, $cmd, $page['frame'].$page['index'], $read, ord($read))); @@ -783,7 +788,8 @@ class Server extends Command // Did the client disconnect if ($read === NULL || socket_last_error()) { - Log::debug('Disconnected: '.$client->getaddress()); + $client->close(); + Log::debug('Client Disconnected: '.$client->getaddress()); return FALSE; }