Few small cleanup things...

This commit is contained in:
Adam Ierymenko 2014-01-26 10:59:33 -08:00
parent 9d67a02b5f
commit 80997f652b
2 changed files with 13 additions and 14 deletions

View File

@ -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<std::string> 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();

View File

@ -47,6 +47,13 @@
#include <ShlObj.h>
#endif
#ifdef __UNIX_LIKE__
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <sys/file.h>
#endif
#include "Condition.hpp"
#include "Node.hpp"
#include "Topology.hpp"
@ -71,15 +78,6 @@
#include "Service.hpp"
#include "SoftwareUpdater.hpp"
#ifdef __WINDOWS__
#include <Windows.h>
#else
#include <fcntl.h>
#include <unistd.h>
#include <signal.h>
#include <sys/file.h>
#endif
#include "../version.h"
namespace ZeroTier {