diff options
| author | Adam Ierymenko <adam.ierymenko@zerotier.com> | 2015-11-13 12:14:28 -0800 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@zerotier.com> | 2015-11-13 12:14:28 -0800 |
| commit | 0d9f33dc4f14b7339d1893e79772a8e49b4821eb (patch) | |
| tree | e7b3e1ee8ec92d57ce71482c64738f4211e5d9ff /node/Node.cpp | |
| parent | 90f9415107fded22346bfa94f98afa73c6c2811e (diff) | |
| download | infinitytier-0d9f33dc4f14b7339d1893e79772a8e49b4821eb.tar.gz infinitytier-0d9f33dc4f14b7339d1893e79772a8e49b4821eb.zip | |
Fix: (1) Windows stack overflow due to buffer too large in peer deserialize, (2) clean up some other stuff seen during debugging and reduce the sizes of some buffers due to Windows small stack size, (3) remove a redundant try/catch.
Diffstat (limited to 'node/Node.cpp')
| -rw-r--r-- | node/Node.cpp | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/node/Node.cpp b/node/Node.cpp index 4b449401..f077424b 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -93,21 +93,22 @@ Node::Node( _prng.encrypt12(_prngStream,_prngStream,sizeof(_prngStream)); } - 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)) - throw std::runtime_error("unable to write identity.secret"); - } - RR->publicIdentityStr = RR->identity.toString(false); - RR->secretIdentityStr = RR->identity.toString(true); - - idtmp = dataStoreGet("identity.public"); - if (idtmp != RR->publicIdentityStr) { - if (!dataStorePut("identity.public",RR->publicIdentityStr,false)) - throw std::runtime_error("unable to write identity.public"); + { + 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)) + throw std::runtime_error("unable to write identity.secret"); + } + RR->publicIdentityStr = RR->identity.toString(false); + RR->secretIdentityStr = RR->identity.toString(true); + idtmp = dataStoreGet("identity.public"); + if (idtmp != RR->publicIdentityStr) { + if (!dataStorePut("identity.public",RR->publicIdentityStr,false)) + throw std::runtime_error("unable to write identity.public"); + } } try { @@ -662,7 +663,7 @@ void Node::backgroundThreadMain() std::string Node::dataStoreGet(const char *name) { - char buf[16384]; + char buf[1024]; std::string r; unsigned long olen = 0; do { |
