mirror of
https://github.com/YGGverse/YGGstate.git
synced 2025-02-03 18:34:20 +00:00
implement tracker, peers JSON API
This commit is contained in:
parent
f03da2cd3d
commit
606a6f1cac
3
.gitignore
vendored
3
.gitignore
vendored
@ -6,5 +6,8 @@
|
||||
|
||||
/src/config/app.php
|
||||
|
||||
/src/public/api/peers.json
|
||||
/src/public/api/trackers.json
|
||||
|
||||
.ftpignore
|
||||
composer.lock
|
||||
|
@ -54,7 +54,12 @@ git checkout -b my-pr-branch-name
|
||||
|
||||
#### Roadmap
|
||||
|
||||
* [ ] Federated tracking API
|
||||
API
|
||||
* [x] trackers
|
||||
* [x] peers
|
||||
|
||||
Crawler
|
||||
* [ ] federated model
|
||||
|
||||
#### Donate to contributors
|
||||
|
||||
|
@ -72,12 +72,13 @@ define('WEBSITE_PEER_REMOTE_PAGINATION_LIMIT', 20);
|
||||
|
||||
define('WEBSITE_PEER_PORT_CHECK_TIMEOUT', 60 * 5);
|
||||
|
||||
// Trackers
|
||||
define('TRACKER_PUBLIC_PEERS', (object)
|
||||
[
|
||||
'tls://94.140.114.241:4708',
|
||||
// ...
|
||||
]);
|
||||
// API
|
||||
define('API_PEERS', (object)
|
||||
[
|
||||
'tls://94.140.114.241:4708' => WEBSITE_URL,
|
||||
// ...
|
||||
]
|
||||
);
|
||||
|
||||
// Crawler
|
||||
define('CRAWL_STOP_DISK_QUOTA_MB_LEFT', 128);
|
@ -129,286 +129,315 @@ try {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Collect connected peers
|
||||
// Delete cache
|
||||
@unlink(__DIR__ . '/../public/api/peers.json');
|
||||
@unlink(__DIR__ . '/../public/api/trackers.json');
|
||||
|
||||
// Update peers
|
||||
if ($connectedPeers = Yggverse\Yggdrasilctl\Yggdrasil::getPeers()) {
|
||||
|
||||
foreach ($connectedPeers as $connectedPeerAddress => $connectedPeerInfo) {
|
||||
if ($handle = fopen(__DIR__ . '/../public/api/peers.json', 'w+')) {
|
||||
fwrite($handle, json_encode($connectedPeers));
|
||||
fclose($handle);
|
||||
}
|
||||
|
||||
try {
|
||||
} else {
|
||||
|
||||
$db->beginTransaction();
|
||||
exit;
|
||||
}
|
||||
|
||||
// Init peer
|
||||
if ($dbPeer = $db->findPeer($connectedPeerAddress)) {
|
||||
// Update trackers
|
||||
if (API_PEERS) {
|
||||
|
||||
$dbPeerId = $dbPeer->peerId;
|
||||
if ($handle = fopen(__DIR__ . '/../public/api/trackers.json', 'w+')) {
|
||||
fwrite($handle, json_encode(API_PEERS));
|
||||
fclose($handle);
|
||||
}
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
if ($dbPeerId = $db->addPeer($connectedPeerAddress, $connectedPeerInfo->key, time())) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$debug['yggdrasil']['peer']['total']['insert']++;
|
||||
}
|
||||
// @TODO merge peers data from remote trackers
|
||||
|
||||
// Collect connected peers
|
||||
foreach ($connectedPeers as $connectedPeerAddress => $connectedPeerInfo) {
|
||||
|
||||
try {
|
||||
|
||||
$db->beginTransaction();
|
||||
|
||||
// Init peer
|
||||
if ($dbPeer = $db->findPeer($connectedPeerAddress)) {
|
||||
|
||||
$dbPeerId = $dbPeer->peerId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbPeerId = $db->addPeer($connectedPeerAddress, $connectedPeerInfo->key, time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Init peer session
|
||||
if ($dbLastPeerSession = $db->findLastPeerSessionByPeerId($dbPeerId)) {
|
||||
// Init peer session
|
||||
if ($dbLastPeerSession = $db->findLastPeerSessionByPeerId($dbPeerId)) {
|
||||
|
||||
$dbPeerSessionId = $dbLastPeerSession->peerSessionId;
|
||||
$dbPeerSessionId = $dbLastPeerSession->peerSessionId;
|
||||
|
||||
// If remote session uptime < than stored, register new one
|
||||
if ($connectedPeerInfo->uptime < $dbLastPeerSession->uptime) {
|
||||
|
||||
if ($dbPeerSessionId = $db->addPeerSession($dbPeerId,
|
||||
round($connectedPeerInfo->uptime),
|
||||
$connectedPeerInfo->bytes_sent,
|
||||
$connectedPeerInfo->bytes_recvd,
|
||||
time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['session']['total']['insert']++;
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$debug['yggdrasil']['peer']['session']['total']['update'] +=
|
||||
$db->updatePeerSession($dbLastPeerSession->peerSessionId,
|
||||
round($connectedPeerInfo->uptime),
|
||||
$connectedPeerInfo->bytes_sent,
|
||||
$connectedPeerInfo->bytes_recvd,
|
||||
time());
|
||||
}
|
||||
|
||||
} else {
|
||||
// If remote session uptime < than stored, register new one
|
||||
if ($connectedPeerInfo->uptime < $dbLastPeerSession->uptime) {
|
||||
|
||||
if ($dbPeerSessionId = $db->addPeerSession($dbPeerId,
|
||||
round($connectedPeerInfo->uptime),
|
||||
$connectedPeerInfo->bytes_sent,
|
||||
$connectedPeerInfo->bytes_recvd,
|
||||
time())) {
|
||||
round($connectedPeerInfo->uptime),
|
||||
$connectedPeerInfo->bytes_sent,
|
||||
$connectedPeerInfo->bytes_recvd,
|
||||
time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['session']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Init peer coordinate
|
||||
if ($dbPeerCoordinate = $db->findLastPeerCoordinateByPeerId($dbPeerId)) {
|
||||
|
||||
$dbPeerCoordinateId = $dbPeerCoordinate->peerCoordinateId;
|
||||
|
||||
// Peer have changed it port, init new coordinate
|
||||
if ($dbPeerCoordinate->port != $connectedPeerInfo->port) {
|
||||
|
||||
if ($dbPeerCoordinateId = $db->addPeerCoordinate($dbPeerId, $connectedPeerInfo->port, time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['coordinate']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
$debug['yggdrasil']['peer']['session']['total']['update'] +=
|
||||
$db->updatePeerSession($dbLastPeerSession->peerSessionId,
|
||||
round($connectedPeerInfo->uptime),
|
||||
$connectedPeerInfo->bytes_sent,
|
||||
$connectedPeerInfo->bytes_recvd,
|
||||
time());
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbPeerSessionId = $db->addPeerSession($dbPeerId,
|
||||
round($connectedPeerInfo->uptime),
|
||||
$connectedPeerInfo->bytes_sent,
|
||||
$connectedPeerInfo->bytes_recvd,
|
||||
time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['session']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Init peer coordinate
|
||||
if ($dbPeerCoordinate = $db->findLastPeerCoordinateByPeerId($dbPeerId)) {
|
||||
|
||||
$dbPeerCoordinateId = $dbPeerCoordinate->peerCoordinateId;
|
||||
|
||||
// Peer have changed it port, init new coordinate
|
||||
if ($dbPeerCoordinate->port != $connectedPeerInfo->port) {
|
||||
|
||||
if ($dbPeerCoordinateId = $db->addPeerCoordinate($dbPeerId, $connectedPeerInfo->port, time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['coordinate']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Init peer coordinate route
|
||||
$dbCoords = [];
|
||||
foreach ($db->findPeerCoordinateRouteByCoordinateId($dbPeerCoordinateId) as $dbPeerCoordinateRoute) {
|
||||
$dbCoords[$dbPeerCoordinateRoute->level] = $dbPeerCoordinateRoute->port;
|
||||
} else {
|
||||
|
||||
if ($dbPeerCoordinateId = $db->addPeerCoordinate($dbPeerId, $connectedPeerInfo->port, time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['coordinate']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Init peer coordinate route
|
||||
$dbCoords = [];
|
||||
foreach ($db->findPeerCoordinateRouteByCoordinateId($dbPeerCoordinateId) as $dbPeerCoordinateRoute) {
|
||||
$dbCoords[$dbPeerCoordinateRoute->level] = $dbPeerCoordinateRoute->port;
|
||||
}
|
||||
|
||||
// Compare remote / local route, create new on changed
|
||||
if ($dbCoords !== $connectedPeerInfo->coords) {
|
||||
|
||||
if ($dbPeerCoordinateId = $db->addPeerCoordinate($dbPeerId, $connectedPeerInfo->port, time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['coordinate']['total']['insert']++;
|
||||
}
|
||||
|
||||
// Compare remote / local route, create new on changed
|
||||
if ($dbCoords !== $connectedPeerInfo->coords) {
|
||||
foreach ($connectedPeerInfo->coords as $level => $port) {
|
||||
|
||||
if ($dbPeerCoordinateId = $db->addPeerCoordinate($dbPeerId, $connectedPeerInfo->port, time())) {
|
||||
if ($db->addPeerCoordinateRoute($dbPeerCoordinateId, $level, $port)) {
|
||||
|
||||
$debug['yggdrasil']['peer']['coordinate']['total']['insert']++;
|
||||
$debug['yggdrasil']['peer']['coordinate']['route']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($connectedPeerInfo->coords as $level => $port) {
|
||||
// Init peer remote
|
||||
if ($connectedPeerRemoteUrl = Yggverse\Parser\Url::parse($connectedPeerInfo->remote)) {
|
||||
|
||||
if ($db->addPeerCoordinateRoute($dbPeerCoordinateId, $level, $port)) {
|
||||
// Init peer scheme
|
||||
if ($dbPeerRemoteScheme = $db->findPeerRemoteScheme($connectedPeerRemoteUrl->host->scheme)) {
|
||||
|
||||
$debug['yggdrasil']['peer']['coordinate']['route']['total']['insert']++;
|
||||
$dbPeerRemoteSchemeId = $dbPeerRemoteScheme->peerRemoteSchemeId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbPeerRemoteSchemeId = $db->addPeerRemoteScheme($connectedPeerRemoteUrl->host->scheme, time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['remote']['scheme']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Init peer host
|
||||
if ($dbPeerRemoteHost = $db->findPeerRemoteHost($connectedPeerRemoteUrl->host->name)) {
|
||||
|
||||
$dbPeerRemoteHostId = $dbPeerRemoteHost->peerRemoteHostId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbPeerRemoteHostId = $db->addPeerRemoteHost($connectedPeerRemoteUrl->host->name, time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['remote']['host']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Init peer port
|
||||
if ($dbPeerRemotePort = $db->findPeerRemotePort($connectedPeerRemoteUrl->host->port)) {
|
||||
|
||||
$dbPeerRemotePortId = $dbPeerRemotePort->peerRemotePortId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbPeerRemotePortId = $db->addPeerRemotePort($connectedPeerRemoteUrl->host->port, time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['remote']['port']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Init geo data
|
||||
|
||||
/// Country
|
||||
$countryIsoCode = $geoIp2Country->country($connectedPeerRemoteUrl->host->name)->country->isoCode;
|
||||
$countryName = $geoIp2Country->country($connectedPeerRemoteUrl->host->name)->country->name;
|
||||
|
||||
$dbGeoCountryId = null;
|
||||
|
||||
if (!empty($countryIsoCode) && !empty($countryName)) {
|
||||
|
||||
if ($dbGeoCountry = $db->findGeoCountryByIsoCode($countryIsoCode)) {
|
||||
|
||||
$dbGeoCountryId = $dbGeoCountry->geoCountryId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbGeoCountryId = $db->addGeoCountry($countryIsoCode, $countryName)) {
|
||||
|
||||
$debug['yggdrasil']['geo']['country']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// City
|
||||
$cityName = $geoIp2City->city($connectedPeerRemoteUrl->host->name)->city->name;
|
||||
|
||||
$dbGeoCityId = null;
|
||||
|
||||
if (!empty($cityName)) {
|
||||
|
||||
if ($dbGeoCity = $db->findGeoCityByName($cityName)) {
|
||||
|
||||
$dbGeoCityId = $dbGeoCity->geoCityId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbGeoCityId = $db->addGeoCity($cityName)) {
|
||||
|
||||
$debug['yggdrasil']['geo']['city']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Coordinate
|
||||
$latitude = $geoIp2City->city($connectedPeerRemoteUrl->host->name)->location->latitude;
|
||||
$longitude = $geoIp2City->city($connectedPeerRemoteUrl->host->name)->location->longitude;
|
||||
|
||||
$dbGeoCoordinateId = null;
|
||||
|
||||
if (!empty($latitude) && !empty($longitude)) {
|
||||
|
||||
if ($dbGeoCoordinate = $db->findGeoCoordinate($geoIp2City->city($connectedPeerRemoteUrl->host->name)->location->latitude,
|
||||
$geoIp2City->city($connectedPeerRemoteUrl->host->name)->location->longitude)) {
|
||||
|
||||
$dbGeoCoordinateId = $dbGeoCoordinate->geoCoordinateId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbGeoCoordinateId = $db->addGeoCoordinate($geoIp2City->city($connectedPeerRemoteUrl->host->name)->location->latitude,
|
||||
$geoIp2City->city($connectedPeerRemoteUrl->host->name)->location->longitude)) {
|
||||
|
||||
$debug['yggdrasil']['geo']['coordinate']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Geo
|
||||
$dbGeoId = null;
|
||||
|
||||
if ($dbGeo = $db->findGeo($dbGeoCountryId, $dbGeoCityId, $dbGeoCoordinateId)) {
|
||||
|
||||
$dbGeoId = $dbGeo->geoId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbGeoId = $db->addGeo($dbGeoCountryId, $dbGeoCityId, $dbGeoCoordinateId)) {
|
||||
|
||||
$debug['yggdrasil']['geo']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Init peer remote
|
||||
if ($connectedPeerRemoteUrl = Yggverse\Parser\Url::parse($connectedPeerInfo->remote)) {
|
||||
if ($dbPeerRemote = $db->findPeerRemote($dbPeerId,
|
||||
$dbGeoId,
|
||||
$dbPeerRemoteSchemeId,
|
||||
$dbPeerRemoteHostId,
|
||||
$dbPeerRemotePortId)) {
|
||||
|
||||
// Init peer scheme
|
||||
if ($dbPeerRemoteScheme = $db->findPeerRemoteScheme($connectedPeerRemoteUrl->host->scheme)) {
|
||||
$dbPeerRemoteId = $dbPeerRemote->peerRemoteId;
|
||||
|
||||
$dbPeerRemoteSchemeId = $dbPeerRemoteScheme->peerRemoteSchemeId;
|
||||
} else {
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbPeerRemoteSchemeId = $db->addPeerRemoteScheme($connectedPeerRemoteUrl->host->scheme, time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['remote']['scheme']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Init peer host
|
||||
if ($dbPeerRemoteHost = $db->findPeerRemoteHost($connectedPeerRemoteUrl->host->name)) {
|
||||
|
||||
$dbPeerRemoteHostId = $dbPeerRemoteHost->peerRemoteHostId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbPeerRemoteHostId = $db->addPeerRemoteHost($connectedPeerRemoteUrl->host->name, time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['remote']['host']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Init peer port
|
||||
if ($dbPeerRemotePort = $db->findPeerRemotePort($connectedPeerRemoteUrl->host->port)) {
|
||||
|
||||
$dbPeerRemotePortId = $dbPeerRemotePort->peerRemotePortId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbPeerRemotePortId = $db->addPeerRemotePort($connectedPeerRemoteUrl->host->port, time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['remote']['port']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Init geo data
|
||||
|
||||
/// Country
|
||||
$countryIsoCode = $geoIp2Country->country($connectedPeerRemoteUrl->host->name)->country->isoCode;
|
||||
$countryName = $geoIp2Country->country($connectedPeerRemoteUrl->host->name)->country->name;
|
||||
|
||||
$dbGeoCountryId = null;
|
||||
|
||||
if (!empty($countryIsoCode) && !empty($countryName)) {
|
||||
|
||||
if ($dbGeoCountry = $db->findGeoCountryByIsoCode($countryIsoCode)) {
|
||||
|
||||
$dbGeoCountryId = $dbGeoCountry->geoCountryId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbGeoCountryId = $db->addGeoCountry($countryIsoCode, $countryName)) {
|
||||
|
||||
$debug['yggdrasil']['geo']['country']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// City
|
||||
$cityName = $geoIp2City->city($connectedPeerRemoteUrl->host->name)->city->name;
|
||||
|
||||
$dbGeoCityId = null;
|
||||
|
||||
if (!empty($cityName)) {
|
||||
|
||||
if ($dbGeoCity = $db->findGeoCityByName($cityName)) {
|
||||
|
||||
$dbGeoCityId = $dbGeoCity->geoCityId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbGeoCityId = $db->addGeoCity($cityName)) {
|
||||
|
||||
$debug['yggdrasil']['geo']['city']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Coordinate
|
||||
$latitude = $geoIp2City->city($connectedPeerRemoteUrl->host->name)->location->latitude;
|
||||
$longitude = $geoIp2City->city($connectedPeerRemoteUrl->host->name)->location->longitude;
|
||||
|
||||
$dbGeoCoordinateId = null;
|
||||
|
||||
if (!empty($latitude) && !empty($longitude)) {
|
||||
|
||||
if ($dbGeoCoordinate = $db->findGeoCoordinate($geoIp2City->city($connectedPeerRemoteUrl->host->name)->location->latitude,
|
||||
$geoIp2City->city($connectedPeerRemoteUrl->host->name)->location->longitude)) {
|
||||
|
||||
$dbGeoCoordinateId = $dbGeoCoordinate->geoCoordinateId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbGeoCoordinateId = $db->addGeoCoordinate($geoIp2City->city($connectedPeerRemoteUrl->host->name)->location->latitude,
|
||||
$geoIp2City->city($connectedPeerRemoteUrl->host->name)->location->longitude)) {
|
||||
|
||||
$debug['yggdrasil']['geo']['coordinate']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Geo
|
||||
$dbGeoId = null;
|
||||
|
||||
if ($dbGeo = $db->findGeo($dbGeoCountryId, $dbGeoCityId, $dbGeoCoordinateId)) {
|
||||
|
||||
$dbGeoId = $dbGeo->geoId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbGeoId = $db->addGeo($dbGeoCountryId, $dbGeoCityId, $dbGeoCoordinateId)) {
|
||||
|
||||
$debug['yggdrasil']['geo']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
// Init peer remote
|
||||
if ($dbPeerRemote = $db->findPeerRemote($dbPeerId,
|
||||
if ($dbPeerRemoteId = $db->addPeerRemote($dbPeerId,
|
||||
$dbGeoId,
|
||||
$dbPeerRemoteSchemeId,
|
||||
$dbPeerRemoteHostId,
|
||||
$dbPeerRemotePortId)) {
|
||||
$dbPeerRemotePortId,
|
||||
time())) {
|
||||
|
||||
$dbPeerRemoteId = $dbPeerRemote->peerRemoteId;
|
||||
|
||||
} else {
|
||||
|
||||
if ($dbPeerRemoteId = $db->addPeerRemote($dbPeerId,
|
||||
$dbGeoId,
|
||||
$dbPeerRemoteSchemeId,
|
||||
$dbPeerRemoteHostId,
|
||||
$dbPeerRemotePortId,
|
||||
time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['remote']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
// If something went wrong with URL parse, skip next operations for this peer
|
||||
} else {
|
||||
|
||||
$db->rollBack();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
// Init peer connection
|
||||
if (!$db->findPeerConnection($dbPeerSessionId, $dbPeerRemoteId, $dbPeerCoordinateId)) {
|
||||
|
||||
if ($db->addPeerConnection($dbPeerSessionId, $dbPeerRemoteId, $dbPeerCoordinateId, time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['connection']['total']['insert']++;
|
||||
$debug['yggdrasil']['peer']['remote']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
$debug['yggdrasil']['peer']['total']['online']++;
|
||||
|
||||
$db->commit();
|
||||
|
||||
} catch(Exception $e) {
|
||||
// If something went wrong with URL parse, skip next operations for this peer
|
||||
} else {
|
||||
|
||||
$db->rollBack();
|
||||
|
||||
var_dump($e);
|
||||
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Init peer connection
|
||||
if (!$db->findPeerConnection($dbPeerSessionId, $dbPeerRemoteId, $dbPeerCoordinateId)) {
|
||||
|
||||
if ($db->addPeerConnection($dbPeerSessionId, $dbPeerRemoteId, $dbPeerCoordinateId, time())) {
|
||||
|
||||
$debug['yggdrasil']['peer']['connection']['total']['insert']++;
|
||||
}
|
||||
}
|
||||
|
||||
$debug['yggdrasil']['peer']['total']['online']++;
|
||||
|
||||
$db->commit();
|
||||
|
||||
} catch(Exception $e) {
|
||||
|
||||
$db->rollBack();
|
||||
|
||||
var_dump($e);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -235,10 +235,10 @@ $results = $sphinx->searchPeers($requestQuery,
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td colspan="5" class="text-right">
|
||||
<?php if (TRACKER_PUBLIC_PEERS) { ?>
|
||||
<?php if (API_PEERS) { ?>
|
||||
<div class="margin-top-8"><?php echo _('trackers') ?></div>
|
||||
<?php foreach (TRACKER_PUBLIC_PEERS as $address) { ?>
|
||||
<div><?php echo $address ?></div>
|
||||
<?php foreach (API_PEERS as $tracker => $website) { ?>
|
||||
<div><?php echo $tracker ?></div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
@ -249,10 +249,10 @@ $results = $sphinx->searchPeers($requestQuery,
|
||||
<tr>
|
||||
<td class="text-center">
|
||||
<div class="margin-y-8"><?php echo _('not found') ?></div>
|
||||
<?php if (TRACKER_PUBLIC_PEERS) { ?>
|
||||
<?php if (API_PEERS) { ?>
|
||||
<div class="margin-y-8"><?php echo _('get yourself tracked by connection') ?></div>
|
||||
<?php foreach (TRACKER_PUBLIC_PEERS as $address) { ?>
|
||||
<div class="margin-y-8"><?php echo $address ?></div>
|
||||
<?php foreach (API_PEERS as $tracker => $website) { ?>
|
||||
<div class="margin-y-8"><?php echo $tracker ?></div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</td>
|
||||
|
Loading…
x
Reference in New Issue
Block a user