mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-04 00:10:52 +00:00
Merge branch 'dev' of http://git.int.zerotier.com/ZeroTier/ZeroTierOne into dev
This commit is contained in:
commit
f9b07c63db
@ -62,40 +62,24 @@ template<unsigned int C>
|
|||||||
class Dictionary
|
class Dictionary
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Dictionary()
|
Dictionary() { memset(_d,0,sizeof(_d)); }
|
||||||
{
|
Dictionary(const char *s) { this->load(s); }
|
||||||
_d[0] = (char)0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Dictionary(const char *s)
|
|
||||||
{
|
|
||||||
if (s) {
|
|
||||||
Utils::scopy(_d,sizeof(_d),s);
|
|
||||||
} else {
|
|
||||||
_d[0] = (char)0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Dictionary(const char *s,unsigned int len)
|
Dictionary(const char *s,unsigned int len)
|
||||||
{
|
{
|
||||||
if (s) {
|
for(unsigned int i=0;i<C;++i) {
|
||||||
if (len > (C-1))
|
if ((s)&&(i < len)) {
|
||||||
len = C-1;
|
if (!(_d[i] = *s))
|
||||||
ZT_FAST_MEMCPY(_d,s,len);
|
s = (const char *)0;
|
||||||
_d[len] = (char)0;
|
else ++s;
|
||||||
} else {
|
} else _d[i] = (char)0;
|
||||||
_d[0] = (char)0;
|
|
||||||
}
|
}
|
||||||
|
_d[C - 1] = (char)0;
|
||||||
}
|
}
|
||||||
|
Dictionary(const Dictionary &d) { memcpy(_d,d._d,C); }
|
||||||
Dictionary(const Dictionary &d)
|
|
||||||
{
|
|
||||||
Utils::scopy(_d,sizeof(_d),d._d);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline Dictionary &operator=(const Dictionary &d)
|
inline Dictionary &operator=(const Dictionary &d)
|
||||||
{
|
{
|
||||||
Utils::scopy(_d,sizeof(_d),d._d);
|
memcpy(_d,d._d,C);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,12 +93,15 @@ public:
|
|||||||
*/
|
*/
|
||||||
inline bool load(const char *s)
|
inline bool load(const char *s)
|
||||||
{
|
{
|
||||||
if (s) {
|
for(unsigned int i=0;i<C;++i) {
|
||||||
return Utils::scopy(_d,sizeof(_d),s);
|
if (s) {
|
||||||
} else {
|
if (!(_d[i] = *s))
|
||||||
_d[0] = (char)0;
|
s = (const char *)0;
|
||||||
return true;
|
else ++s;
|
||||||
|
} else _d[i] = (char)0;
|
||||||
}
|
}
|
||||||
|
_d[C - 1] = (char)0;
|
||||||
|
return (!s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -122,7 +109,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
inline void clear()
|
inline void clear()
|
||||||
{
|
{
|
||||||
_d[0] = (char)0;
|
memset(_d,0,sizeof(_d));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,6 +50,7 @@ namespace ZeroTier {
|
|||||||
Switch::Switch(const RuntimeEnvironment *renv) :
|
Switch::Switch(const RuntimeEnvironment *renv) :
|
||||||
RR(renv),
|
RR(renv),
|
||||||
_lastBeaconResponse(0),
|
_lastBeaconResponse(0),
|
||||||
|
_lastCheckedQueues(0),
|
||||||
_lastUniteAttempt(8) // only really used on root servers and upstreams, and it'll grow there just fine
|
_lastUniteAttempt(8) // only really used on root servers and upstreams, and it'll grow there just fine
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1593,7 +1593,7 @@ public:
|
|||||||
|
|
||||||
if (syncRoutes) {
|
if (syncRoutes) {
|
||||||
char tapdev[64];
|
char tapdev[64];
|
||||||
#ifdef __WINDOWS__
|
#if defined(__WINDOWS__) && !defined(ZT_SDK)
|
||||||
OSUtils::ztsnprintf(tapdev,sizeof(tapdev),"%.16llx",(unsigned long long)n.tap->luid().Value);
|
OSUtils::ztsnprintf(tapdev,sizeof(tapdev),"%.16llx",(unsigned long long)n.tap->luid().Value);
|
||||||
#else
|
#else
|
||||||
Utils::scopy(tapdev,sizeof(tapdev),n.tap->deviceName().c_str());
|
Utils::scopy(tapdev,sizeof(tapdev),n.tap->deviceName().c_str());
|
||||||
@ -1998,7 +1998,7 @@ public:
|
|||||||
case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_CONFIG_UPDATE:
|
case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_CONFIG_UPDATE:
|
||||||
ZT_FAST_MEMCPY(&(n.config),nwc,sizeof(ZT_VirtualNetworkConfig));
|
ZT_FAST_MEMCPY(&(n.config),nwc,sizeof(ZT_VirtualNetworkConfig));
|
||||||
if (n.tap) { // sanity check
|
if (n.tap) { // sanity check
|
||||||
#ifdef __WINDOWS__
|
#if defined(__WINDOWS__) && !defined(ZT_SDK)
|
||||||
// wait for up to 5 seconds for the WindowsEthernetTap to actually be initialized
|
// wait for up to 5 seconds for the WindowsEthernetTap to actually be initialized
|
||||||
//
|
//
|
||||||
// without WindowsEthernetTap::isInitialized() returning true, the won't actually
|
// without WindowsEthernetTap::isInitialized() returning true, the won't actually
|
||||||
@ -2019,7 +2019,7 @@ public:
|
|||||||
case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_DOWN:
|
case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_DOWN:
|
||||||
case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_DESTROY:
|
case ZT_VIRTUAL_NETWORK_CONFIG_OPERATION_DESTROY:
|
||||||
if (n.tap) { // sanity check
|
if (n.tap) { // sanity check
|
||||||
#ifdef __WINDOWS__
|
#if defined(__WINDOWS__) && !defined(ZT_SDK)
|
||||||
std::string winInstanceId(n.tap->instanceId());
|
std::string winInstanceId(n.tap->instanceId());
|
||||||
#endif
|
#endif
|
||||||
*nuptr = (void *)0;
|
*nuptr = (void *)0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user