Fix crash on exit in Windows (does not affect other OSes) and revert debugging tweak in Windows version that prevented service from starting after real install.
This commit is contained in:
@@ -96,7 +96,9 @@ Topology::Topology(const RuntimeEnvironment *renv) :
|
|||||||
|
|
||||||
Topology::~Topology()
|
Topology::~Topology()
|
||||||
{
|
{
|
||||||
Buffer<ZT_PEER_SUGGESTED_SERIALIZATION_BUFFER_SIZE> pbuf;
|
Buffer<ZT_PEER_SUGGESTED_SERIALIZATION_BUFFER_SIZE> *pbuf = 0;
|
||||||
|
try {
|
||||||
|
pbuf = new Buffer<ZT_PEER_SUGGESTED_SERIALIZATION_BUFFER_SIZE>();
|
||||||
std::string all;
|
std::string all;
|
||||||
|
|
||||||
Address *a = (Address *)0;
|
Address *a = (Address *)0;
|
||||||
@@ -104,11 +106,11 @@ Topology::~Topology()
|
|||||||
Hashtable< Address,SharedPtr<Peer> >::Iterator i(_peers);
|
Hashtable< Address,SharedPtr<Peer> >::Iterator i(_peers);
|
||||||
while (i.next(a,p)) {
|
while (i.next(a,p)) {
|
||||||
if (std::find(_rootAddresses.begin(),_rootAddresses.end(),*a) == _rootAddresses.end()) {
|
if (std::find(_rootAddresses.begin(),_rootAddresses.end(),*a) == _rootAddresses.end()) {
|
||||||
pbuf.clear();
|
pbuf->clear();
|
||||||
try {
|
try {
|
||||||
(*p)->serialize(pbuf);
|
(*p)->serialize(*pbuf);
|
||||||
try {
|
try {
|
||||||
all.append((const char *)pbuf.data(),pbuf.size());
|
all.append((const char *)pbuf->data(),pbuf->size());
|
||||||
} catch ( ... ) {
|
} catch ( ... ) {
|
||||||
return; // out of memory? just skip
|
return; // out of memory? just skip
|
||||||
}
|
}
|
||||||
@@ -117,6 +119,11 @@ Topology::~Topology()
|
|||||||
}
|
}
|
||||||
|
|
||||||
RR->node->dataStorePut("peers.save",all,true);
|
RR->node->dataStorePut("peers.save",all,true);
|
||||||
|
|
||||||
|
delete pbuf;
|
||||||
|
} catch ( ... ) {
|
||||||
|
delete pbuf;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SharedPtr<Peer> Topology::addPeer(const SharedPtr<Peer> &peer)
|
SharedPtr<Peer> Topology::addPeer(const SharedPtr<Peer> &peer)
|
||||||
|
|||||||
2
one.cpp
2
one.cpp
@@ -966,7 +966,7 @@ int main(int argc,char **argv)
|
|||||||
#ifdef ZT_WIN_RUN_IN_CONSOLE
|
#ifdef ZT_WIN_RUN_IN_CONSOLE
|
||||||
bool winRunFromCommandLine = true;
|
bool winRunFromCommandLine = true;
|
||||||
#else
|
#else
|
||||||
bool winRunFromCommandLine = true;
|
bool winRunFromCommandLine = false;
|
||||||
#endif
|
#endif
|
||||||
#endif // __WINDOWS__
|
#endif // __WINDOWS__
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user