version 4.0.0_alpha

in almost all methods removed timeouts in milliseconds, replaced to PISystemTime
PITimer rewrite, remove internal impl, now only thread implementation, API similar to PIThread
PITimer API no longer pass void*
PIPeer, PIConnection improved stability on reinit and exit
PISystemTime new methods
pisd now exit without hanging
This commit is contained in:
2024-07-30 14:18:02 +03:00
parent f07c9cbce8
commit 1c7fc39b6c
58 changed files with 677 additions and 1191 deletions

View File

@@ -21,20 +21,19 @@
#include "file_manager.h"
#include "picli.h"
#include "piintrospection_server.h"
#include "piliterals_time.h"
#include "piprocess.h"
#include "pisingleapplication.h"
#include "pisysteminfo.h"
#include "pisystemmonitor.h"
#include "shared.h"
class _Init {
public:
_Init() { randomize(); }
};
_Init _pisd_init;
STATIC_INITIALIZER_BEGIN
randomize();
STATIC_INITIALIZER_END
PISystemMonitor sys_mon;
PIScreen * screen = 0;
PIScreen * screen = nullptr;
class MainMenu: public PITimer {
@@ -93,7 +92,7 @@ public:
CONNECTU(screen, tileEvent, this, tileEvent)
CONNECTU(screen, keyPressed, this, keyEvent)
CONNECTU(&daemon_, menuRequest, this, menuRequest)
start(25);
start(40_Hz);
}
PIScreenTile * menuTile() {
TileList * ret = new TileList();
@@ -185,13 +184,19 @@ public:
addrs_tl->content.clear();
peerinfo_tl->content.clear();
peermap_tl->content.clear();
peers_tl->content << TileList::Row("this | 0 | 0 | " + PIString::fromNumber(daemon_.allPeers().size_s())
// + " [em = " + PIString::fromBool(daemon_.lockedEth()) + ",
//" "mm = " + PIString::fromBool(daemon_.lockedMBcasts()) + ", " "sm = " +
//PIString::fromBool(daemon_.lockedSends()) + ", " "ms = " +
//PIString::fromBool(daemon_.lockedMCSends()) + ", " "pm = " + PIString::fromBool(pm) + "]"
,
CellFormat());
peers_tl->content << TileList::Row(
"this | 0 | 0 | " + PIString::fromNumber(daemon_.allPeers().size_s())
// + " [em = " + PIString::fromBool(daemon_.lockedEth()) + ",
//" "mm = " + PIString::fromBool(daemon_.lockedMBcasts()) + ", "
//"sm
//=
//"
//+ PIString::fromBool(daemon_.lockedSends()) + ", " "ms = " +
// PIString::fromBool(daemon_.lockedMCSends()) + ", " "pm = " + PIString::fromBool(pm)
// +
// "]"
,
CellFormat());
piForeachC(PIPeer::PeerInfo & p, daemon_.allPeers())
peers_tl->content << TileList::Row(p.name + " | d = " + PIString::fromNumber(p.dist) + " | p = " +
PIString::fromNumber(p.ping()) + " | n = " + PIString::fromBool(p.isNeighbour()),
@@ -246,7 +251,7 @@ public:
}
screen->unlock();
}
void tick(void * data_, int delimiter) override {
void tick(int delimiter) override {
if (tpeerdiag->visible || tpeer->visible) updatePeerInfo();
if (tinfo->visible) updateSysMon();
}
@@ -420,7 +425,7 @@ int main(int argc, char * argv[]) {
ls.enableExitCapture(PIKbdListener::F10);
ls.start();
WAIT_FOR_EXIT
ls.stop();
ls.stopAndWait();
} else {
screen->start();
screen->waitForFinish();