Browse Source

add full peer info

main
D4708 3 years ago
parent
commit
777016df66
  1. 33
      model/ip.php
  2. 15
      peer.php

33
model/ip.php

@ -82,7 +82,18 @@ class ModelIp extends Model { @@ -82,7 +82,18 @@ class ModelIp extends Model {
}
}
public function addOnline($ipId, $startingHeight, $timeConnection, $timeLastSend, $timeLastReceive) {
public function addOnline($ipId,
$startingHeight,
$timeConnection,
$timeLastSend,
$timeLastReceive,
$bytesSent,
$bytesReceive,
$banscore,
$inbound,
$version,
$subVersion,
$syncNode) {
try {
@ -91,10 +102,28 @@ class ModelIp extends Model { @@ -91,10 +102,28 @@ class ModelIp extends Model {
`timeConnection` = ?,
`timeLastSend` = ?,
`timeLastReceive` = ?,
`bytesSent` = ?,
`bytesReceive` = ?,
`banscore` = ?,
`inbound` = ?,
`version` = ?,
`subVersion` = ?,
`syncNode` = ?,
`timeAdded` = UNIX_TIMESTAMP()');
$query->execute([$ipId, $startingHeight, $timeConnection, $timeLastSend, $timeLastReceive]);
$query->execute([ $ipId,
$startingHeight,
$timeConnection,
$timeLastSend,
$timeLastReceive,
$bytesSent,
$bytesReceive,
$banscore,
$inbound,
$version,
$subVersion,
$syncNode]);
return $this->db->lastInsertId();

15
peer.php

@ -83,10 +83,17 @@ if ($peers = $curlPeer->getAll()) { @@ -83,10 +83,17 @@ if ($peers = $curlPeer->getAll()) {
// Update online time
$modelIp->addOnline($ipId,
$peer['startingheight'],
$peer['conntime'],
$peer['lastsend'],
$peer['lastrecv']);
(int) $peer['startingheight'],
(int) $peer['conntime'],
(int) $peer['lastsend'],
(int) $peer['lastrecv'],
(int) $peer['bytessent'],
(int) $peer['bytesrecv'],
(int) $peer['banscore'],
(int) $peer['inbound'],
(int) $peer['version'],
preg_replace('/[^\d]/', '', $peer['subver']),
(isset($peer['syncnode']) ? (int) $peer['syncnode'] : 0));
} else {
$modelLog->add(_('Could not extract peer address or port'));
}

Loading…
Cancel
Save