From 80997f652b2c2cbca615174f9b2dd09411d723a9 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Sun, 26 Jan 2014 10:59:33 -0800 Subject: [PATCH] Few small cleanup things... --- ZeroTierUI/mainwindow.cpp | 11 ++++++----- node/Node.cpp | 16 +++++++--------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/ZeroTierUI/mainwindow.cpp b/ZeroTierUI/mainwindow.cpp index 3e4e96a05..4e73ccfa8 100644 --- a/ZeroTierUI/mainwindow.cpp +++ b/ZeroTierUI/mainwindow.cpp @@ -190,9 +190,9 @@ void MainWindow::timerEvent(QTimerEvent *event) zeroTierClient = new ZeroTier::Node::LocalClient(authToken.c_str(),0,&handleZTMessage,this); } - if (++this->cyclesSinceResponseFromService >= 4) { - if (this->cyclesSinceResponseFromService == 4) - QMessageBox::warning(this,"Service Not Running","Can't Connect to the ZeroTier One service. Is it running?",QMessageBox::Ok); + if (++this->cyclesSinceResponseFromService >= 3) { + if (this->cyclesSinceResponseFromService == 3) + QMessageBox::warning(this,"Service Not Running","Can't connect to the ZeroTier One service. Is it running?",QMessageBox::Ok); ui->noNetworksLabel->setVisible(true); ui->noNetworksLabel->setText("Connecting to Service..."); ui->bottomContainerWidget->setVisible(false); @@ -206,18 +206,19 @@ void MainWindow::timerEvent(QTimerEvent *event) void MainWindow::customEvent(QEvent *event) { + QMessageBox::information(this,"event","event",QMessageBox::Ok); ZTMessageEvent *m = (ZTMessageEvent *)event; // only one custom event type so far if (m->ztMessage.size() == 0) return; + this->cyclesSinceResponseFromService = 0; + std::vector hdr(ZeroTier::Node::LocalClient::splitLine(m->ztMessage[0])); if (hdr.size() < 2) return; if (hdr[0] != "200") return; - this->cyclesSinceResponseFromService = 0; - if (hdr[1] == "info") { if (hdr.size() >= 3) this->myAddress = hdr[2].c_str(); diff --git a/node/Node.cpp b/node/Node.cpp index 25c080676..71f3e0871 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -47,6 +47,13 @@ #include #endif +#ifdef __UNIX_LIKE__ +#include +#include +#include +#include +#endif + #include "Condition.hpp" #include "Node.hpp" #include "Topology.hpp" @@ -71,15 +78,6 @@ #include "Service.hpp" #include "SoftwareUpdater.hpp" -#ifdef __WINDOWS__ -#include -#else -#include -#include -#include -#include -#endif - #include "../version.h" namespace ZeroTier {