|
@@ -702,9 +702,9 @@ bool Node::online()
|
|
throw()
|
|
throw()
|
|
{
|
|
{
|
|
_NodeImpl *impl = (_NodeImpl *)_impl;
|
|
_NodeImpl *impl = (_NodeImpl *)_impl;
|
|
- if (!impl->running)
|
|
|
|
- return false;
|
|
|
|
RuntimeEnvironment *RR = (RuntimeEnvironment *)&(impl->renv);
|
|
RuntimeEnvironment *RR = (RuntimeEnvironment *)&(impl->renv);
|
|
|
|
+ if ((!RR)||(!RR->initialized))
|
|
|
|
+ return false;
|
|
uint64_t now = Utils::now();
|
|
uint64_t now = Utils::now();
|
|
uint64_t since = RR->timeOfLastResynchronize;
|
|
uint64_t since = RR->timeOfLastResynchronize;
|
|
std::vector< SharedPtr<Peer> > snp(RR->topology->supernodePeers());
|
|
std::vector< SharedPtr<Peer> > snp(RR->topology->supernodePeers());
|
|
@@ -753,7 +753,8 @@ void Node::join(uint64_t nwid)
|
|
{
|
|
{
|
|
_NodeImpl *impl = (_NodeImpl *)_impl;
|
|
_NodeImpl *impl = (_NodeImpl *)_impl;
|
|
RuntimeEnvironment *RR = (RuntimeEnvironment *)&(impl->renv);
|
|
RuntimeEnvironment *RR = (RuntimeEnvironment *)&(impl->renv);
|
|
- RR->nc->join(nwid);
|
|
|
|
|
|
+ if ((RR)&&(RR->initialized))
|
|
|
|
+ RR->nc->join(nwid);
|
|
}
|
|
}
|
|
|
|
|
|
void Node::leave(uint64_t nwid)
|
|
void Node::leave(uint64_t nwid)
|
|
@@ -761,7 +762,8 @@ void Node::leave(uint64_t nwid)
|
|
{
|
|
{
|
|
_NodeImpl *impl = (_NodeImpl *)_impl;
|
|
_NodeImpl *impl = (_NodeImpl *)_impl;
|
|
RuntimeEnvironment *RR = (RuntimeEnvironment *)&(impl->renv);
|
|
RuntimeEnvironment *RR = (RuntimeEnvironment *)&(impl->renv);
|
|
- RR->nc->leave(nwid);
|
|
|
|
|
|
+ if ((RR)&&(RR->initialized))
|
|
|
|
+ RR->nc->leave(nwid);
|
|
}
|
|
}
|
|
|
|
|
|
struct GatherPeerStatistics
|
|
struct GatherPeerStatistics
|
|
@@ -785,6 +787,9 @@ void Node::status(ZT1_Node_Status *status)
|
|
|
|
|
|
memset(status,0,sizeof(ZT1_Node_Status));
|
|
memset(status,0,sizeof(ZT1_Node_Status));
|
|
|
|
|
|
|
|
+ if ((!RR)||(!RR->initialized))
|
|
|
|
+ return;
|
|
|
|
+
|
|
Utils::scopy(status->publicIdentity,sizeof(status->publicIdentity),RR->identity.toString(false).c_str());
|
|
Utils::scopy(status->publicIdentity,sizeof(status->publicIdentity),RR->identity.toString(false).c_str());
|
|
RR->identity.address().toString(status->address,sizeof(status->address));
|
|
RR->identity.address().toString(status->address,sizeof(status->address));
|
|
status->rawAddress = RR->identity.address().toInt();
|
|
status->rawAddress = RR->identity.address().toInt();
|
|
@@ -807,6 +812,7 @@ void Node::status(ZT1_Node_Status *status)
|
|
|
|
|
|
status->online = online();
|
|
status->online = online();
|
|
status->running = impl->running;
|
|
status->running = impl->running;
|
|
|
|
+ status->initialized = true;
|
|
}
|
|
}
|
|
|
|
|
|
struct CollectPeersAndPaths
|
|
struct CollectPeersAndPaths
|
|
@@ -824,6 +830,9 @@ ZT1_Node_PeerList *Node::listPeers()
|
|
_NodeImpl *impl = (_NodeImpl *)_impl;
|
|
_NodeImpl *impl = (_NodeImpl *)_impl;
|
|
RuntimeEnvironment *RR = (RuntimeEnvironment *)&(impl->renv);
|
|
RuntimeEnvironment *RR = (RuntimeEnvironment *)&(impl->renv);
|
|
|
|
|
|
|
|
+ if ((!RR)||(!RR->initialized))
|
|
|
|
+ return (ZT1_Node_PeerList *)0;
|
|
|
|
+
|
|
CollectPeersAndPaths pp;
|
|
CollectPeersAndPaths pp;
|
|
RR->topology->eachPeer<CollectPeersAndPaths &>(pp);
|
|
RR->topology->eachPeer<CollectPeersAndPaths &>(pp);
|
|
std::sort(pp.data.begin(),pp.data.end(),SortPeersAndPathsInAscendingAddressOrder());
|
|
std::sort(pp.data.begin(),pp.data.end(),SortPeersAndPathsInAscendingAddressOrder());
|
|
@@ -910,6 +919,9 @@ ZT1_Node_Network *Node::getNetworkStatus(uint64_t nwid)
|
|
_NodeImpl *impl = (_NodeImpl *)_impl;
|
|
_NodeImpl *impl = (_NodeImpl *)_impl;
|
|
RuntimeEnvironment *RR = (RuntimeEnvironment *)&(impl->renv);
|
|
RuntimeEnvironment *RR = (RuntimeEnvironment *)&(impl->renv);
|
|
|
|
|
|
|
|
+ if ((!RR)||(!RR->initialized))
|
|
|
|
+ return (ZT1_Node_Network *)0;
|
|
|
|
+
|
|
SharedPtr<Network> network(RR->nc->network(nwid));
|
|
SharedPtr<Network> network(RR->nc->network(nwid));
|
|
if (!network)
|
|
if (!network)
|
|
return (ZT1_Node_Network *)0;
|
|
return (ZT1_Node_Network *)0;
|
|
@@ -950,6 +962,9 @@ ZT1_Node_NetworkList *Node::listNetworks()
|
|
_NodeImpl *impl = (_NodeImpl *)_impl;
|
|
_NodeImpl *impl = (_NodeImpl *)_impl;
|
|
RuntimeEnvironment *RR = (RuntimeEnvironment *)&(impl->renv);
|
|
RuntimeEnvironment *RR = (RuntimeEnvironment *)&(impl->renv);
|
|
|
|
|
|
|
|
+ if ((!RR)||(!RR->initialized))
|
|
|
|
+ return (ZT1_Node_NetworkList *)0;
|
|
|
|
+
|
|
std::vector< SharedPtr<Network> > networks(RR->nc->networks());
|
|
std::vector< SharedPtr<Network> > networks(RR->nc->networks());
|
|
std::vector< SharedPtr<NetworkConfig> > nconfs(networks.size());
|
|
std::vector< SharedPtr<NetworkConfig> > nconfs(networks.size());
|
|
std::vector< std::set<InetAddress> > ipsv(networks.size());
|
|
std::vector< std::set<InetAddress> > ipsv(networks.size());
|