diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-04-09 20:54:00 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-04-09 20:54:00 -0700 |
commit | 068d311ecc7b52f1adaa894864afa54ef49a3e6e (patch) | |
tree | e62de1256cbc981f159c8b023ce1b6bbbc3f27cd /node/Node.cpp | |
parent | 38200cc6a55c3b11502a78251c2bdf09960a2a03 (diff) | |
download | infinitytier-068d311ecc7b52f1adaa894864afa54ef49a3e6e.tar.gz infinitytier-068d311ecc7b52f1adaa894864afa54ef49a3e6e.zip |
TRACE compile fixes, other fixes, and it basically works! It says HELLO.
Diffstat (limited to 'node/Node.cpp')
-rw-r--r-- | node/Node.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/node/Node.cpp b/node/Node.cpp index e6f73879..0192c49a 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -82,6 +82,7 @@ Node::Node( std::string idtmp(dataStoreGet("identity.secret")); if ((!idtmp.length())||(!RR->identity.fromString(idtmp))||(!RR->identity.hasPrivate())) { + TRACE("identity.secret not found, generating..."); RR->identity.generate(); idtmp = RR->identity.toString(true); if (!dataStorePut("identity.secret",idtmp,true)) { @@ -444,10 +445,16 @@ void Node::postTrace(const char *module,unsigned int line,const char *fmt,...) #ifdef __WINDOWS__ ctime_s(tmp3,sizeof(tmp3),&now); - const char *nowstr = tmp3; + char *nowstr = tmp3; #else - const char *nowstr = ctime_r(&now,tmp3); + time_t now = (time_t)(_now / 1000ULL); + char *nowstr = ctime_r(&now,tmp3); #endif + unsigned long nowstrlen = strlen(nowstr); + if (nowstr[nowstrlen-1] == '\n') + nowstr[--nowstrlen] = (char)0; + if (nowstr[nowstrlen-1] == '\r') + nowstr[--nowstrlen] = (char)0; va_start(ap,fmt); vsnprintf(tmp2,sizeof(tmp2),fmt,ap); |