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

15
peer.php

@ -83,10 +83,17 @@ if ($peers = $curlPeer->getAll()) {
// Update online time // Update online time
$modelIp->addOnline($ipId, $modelIp->addOnline($ipId,
$peer['startingheight'], (int) $peer['startingheight'],
$peer['conntime'], (int) $peer['conntime'],
$peer['lastsend'], (int) $peer['lastsend'],
$peer['lastrecv']); (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 { } else {
$modelLog->add(_('Could not extract peer address or port')); $modelLog->add(_('Could not extract peer address or port'));
} }

Loading…
Cancel
Save