mirror of
https://github.com/twisterarmy/twister-analytics-crawler.git
synced 2025-01-30 16:34:18 +00:00
add full peer info
This commit is contained in:
parent
84ecbdf07a
commit
777016df66
33
model/ip.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
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…
x
Reference in New Issue
Block a user