Capture SocketException when server terminated normally.
This commit is contained in:
parent
aa4bafc391
commit
67b2382c84
@ -8,12 +8,14 @@
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Classes\Frame;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Sock\{SocketClient,SocketServer,SocketException};
|
||||
|
||||
use App\Classes\Frame as FrameClass;
|
||||
use App\Models\Frame as FrameModel;
|
||||
|
||||
class Server extends Command
|
||||
{
|
||||
// Size of Bottom Line Pollution
|
||||
@ -70,7 +72,16 @@ class Server extends Command
|
||||
$server = new SocketServer(config('app.port'),config('app.bind'));
|
||||
$server->init();
|
||||
$server->setConnectionHandler([$this,'onConnect']);
|
||||
$server->listen();
|
||||
|
||||
try {
|
||||
$server->listen();
|
||||
|
||||
} catch (SocketException $e) {
|
||||
if ($e->getMessage() == 'Can\'t accept connections: "Success"')
|
||||
Log::debug('Server Terminated.');
|
||||
else
|
||||
Log::emergency('Uncaught Message: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -364,7 +375,7 @@ class Server extends Command
|
||||
$page['frame'] = $pagedata['route1'];
|
||||
$page['index'] = 'a';
|
||||
|
||||
} elseif (\App\Models\Frame::where('frame',$fo->frame())->where('index',$fo->index_next())->exists()) {
|
||||
} elseif (FrameModel::where('frame',$fo->frame())->where('index',$fo->index_next())->exists()) {
|
||||
$action = ACTION_GOTO;
|
||||
$page['frame'] = array_get($current,'page.frame');
|
||||
$page['index'] = chr(1 + ord($page['index']));
|
||||
@ -402,7 +413,7 @@ class Server extends Command
|
||||
$page['frame'] = $pagedata['route2'];
|
||||
$page['index'] = 'a';
|
||||
|
||||
} elseif (\App\Models\Frame::where('frame',$fo->frame())->where('index',$fo->index_next())->exists()) {
|
||||
} elseif (FrameModel::where('frame',$fo->frame())->where('index',$fo->index_next())->exists()) {
|
||||
$action = ACTION_GOTO;
|
||||
$page['frame'] = $fo->frame();
|
||||
$page['index'] = $fo->index_next();
|
||||
@ -625,8 +636,8 @@ class Server extends Command
|
||||
|
||||
try {
|
||||
$fo = $timewarpalt
|
||||
? new \App\Classes\Frame(\App\Models\Frame::findOrFail($timewarpalt))
|
||||
: (new \App\Models\Frame)->fetch($page['frame'],$page['index']);
|
||||
? new FrameClass(FrameModel::findOrFail($timewarpalt))
|
||||
: (new FrameModel)->fetch($page['frame'],$page['index']);
|
||||
|
||||
} catch (ModelNotFoundException $e) {
|
||||
$this->sendBaseline($client,ERR_PAGE);
|
||||
|
Reference in New Issue
Block a user