Log systems polling

This commit is contained in:
Deon George
2022-12-02 22:54:02 +11:00
parent d5d4a0d781
commit 170f5c87ed
5 changed files with 81 additions and 4 deletions

View File

@@ -9,7 +9,7 @@ use Illuminate\Support\Facades\Log;
use App\Classes\File\{Receive,Send};
use App\Classes\Sock\SocketClient;
use App\Classes\Sock\SocketException;
use App\Models\{Address,Setup,System};
use App\Models\{Address,Setup,System,SystemLog};
abstract class Protocol
{
@@ -324,10 +324,19 @@ abstract class Protocol
foreach ($this->node->aka_other as $aka) {
Address::findFTN($aka,TRUE,$so);
}
}
// @todo Log to history log in the DB.
//if ($this->node->start_time && $this->setup->cfg('CFG_HISTORY')) {}
// Log session in DB
$slo = new SystemLog;
$slo->items_sent = $this->send->total_sent;
$slo->items_sent_size = $this->send->total_sent_bytes;
$slo->items_recv = $this->recv->total_recv;
$slo->items_recv_size = $this->recv->total_recv_bytes;
$slo->sessiontype = $type;
$slo->sessiontime = $this->node->session_time;
$slo->result = ($rc & self::S_MASK);
$so->logs()->save($slo);
}
// @todo Optional after session execution event
// if ($this->node->start_time && $this->setup->cfg('CFG_AFTERSESSION')) {}