mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-06 11:10:13 +00:00
Make crypto and compression build optimized in debug, and also try disabling peers.persist -- might ship this way as it seems more trouble than its worth.
This commit is contained in:
parent
8b0846d077
commit
6316011024
@ -38,10 +38,13 @@ endif
|
|||||||
|
|
||||||
# "make debug" is a shortcut for this
|
# "make debug" is a shortcut for this
|
||||||
ifeq ($(ZT_DEBUG),1)
|
ifeq ($(ZT_DEBUG),1)
|
||||||
CFLAGS=-Wall -g -pthread $(INCLUDES) -DZT_TRACE -DZT_LOG_STDOUT $(DEFS)
|
# DEFS+=-DZT_TRACE -DZT_LOG_STDOUT
|
||||||
|
CFLAGS=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||||
LDFLAGS=
|
LDFLAGS=
|
||||||
STRIP=echo
|
STRIP=echo
|
||||||
DEFS+=-DZT_TRACE -DZT_LOG_STDOUT
|
# The following line enables optimization for the crypto code, since
|
||||||
|
# C25519 in particular is almost UNUSABLE in heavy testing without it.
|
||||||
|
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -ftree-vectorize -pthread $(INCLUDES) $(DEFS)
|
||||||
else
|
else
|
||||||
CFLAGS=-Wall -O3 -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
CFLAGS=-Wall -O3 -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS)
|
||||||
LDFLAGS=-pie -Wl,-z,relro,-z,now
|
LDFLAGS=-pie -Wl,-z,relro,-z,now
|
||||||
|
@ -24,9 +24,12 @@ DEFS+=-DZT_SALSA20_SSE
|
|||||||
|
|
||||||
# "make debug" is a shortcut for this
|
# "make debug" is a shortcut for this
|
||||||
ifeq ($(ZT_DEBUG),1)
|
ifeq ($(ZT_DEBUG),1)
|
||||||
CFLAGS=-Wall -g -pthread -DZT_TRACE -DZT_LOG_STDOUT $(INCLUDES) $(DEFS)
|
# DEFS+=-DZT_TRACE -DZT_LOG_STDOUT
|
||||||
|
CFLAGS=-Wall -g -pthread $(INCLUDES) $(DEFS)
|
||||||
STRIP=echo
|
STRIP=echo
|
||||||
DEFS+=-DZT_TRACE -DZT_LOG_STDOUT
|
# The following line enables optimization for the crypto code, since
|
||||||
|
# C25519 in particular is almost UNUSABLE in heavy testing without it.
|
||||||
|
ext/lz4/lz4.o node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -ftree-vectorize -pthread $(INCLUDES) $(DEFS)
|
||||||
else
|
else
|
||||||
CFLAGS=-arch i386 -arch x86_64 -Wall -O3 -flto -fPIE -fvectorize -fstack-protector -pthread -mmacosx-version-min=10.6 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
|
CFLAGS=-arch i386 -arch x86_64 -Wall -O3 -flto -fPIE -fvectorize -fstack-protector -pthread -mmacosx-version-min=10.6 -DNDEBUG -Wno-unused-private-field $(INCLUDES) $(DEFS)
|
||||||
STRIP=strip
|
STRIP=strip
|
||||||
|
@ -50,7 +50,8 @@
|
|||||||
#include "NonCopyable.hpp"
|
#include "NonCopyable.hpp"
|
||||||
#include "Mutex.hpp"
|
#include "Mutex.hpp"
|
||||||
|
|
||||||
#define ZT_PEER_SERIALIZATION_VERSION 13
|
// Comment out to disable peers.persist
|
||||||
|
//#define ZT_PEER_SERIALIZATION_VERSION 13
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
@ -404,6 +405,7 @@ public:
|
|||||||
else return std::pair<InetAddress,InetAddress>();
|
else return std::pair<InetAddress,InetAddress>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef ZT_PEER_SERIALIZATION_VERSION
|
||||||
template<unsigned int C>
|
template<unsigned int C>
|
||||||
inline void serialize(Buffer<C> &b) const
|
inline void serialize(Buffer<C> &b) const
|
||||||
{
|
{
|
||||||
@ -456,6 +458,7 @@ public:
|
|||||||
|
|
||||||
return (p - startAt);
|
return (p - startAt);
|
||||||
}
|
}
|
||||||
|
#endif // ZT_PEER_SERIALIZATION_VERSION
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _announceMulticastGroups(const RuntimeEnvironment *RR,uint64_t now);
|
void _announceMulticastGroups(const RuntimeEnvironment *RR,uint64_t now);
|
||||||
|
@ -290,6 +290,7 @@ bool Topology::authenticateRootTopology(const Dictionary &rt)
|
|||||||
|
|
||||||
void Topology::_dumpPeers()
|
void Topology::_dumpPeers()
|
||||||
{
|
{
|
||||||
|
#ifdef ZT_PEER_SERIALIZATION_VERSION
|
||||||
Buffer<ZT_PEER_WRITE_BUF_SIZE> buf;
|
Buffer<ZT_PEER_WRITE_BUF_SIZE> buf;
|
||||||
std::string pdpath(RR->homePath + ZT_PATH_SEPARATOR_S + "peers.persist");
|
std::string pdpath(RR->homePath + ZT_PATH_SEPARATOR_S + "peers.persist");
|
||||||
Mutex::Lock _l(_activePeers_m);
|
Mutex::Lock _l(_activePeers_m);
|
||||||
@ -335,14 +336,18 @@ void Topology::_dumpPeers()
|
|||||||
}
|
}
|
||||||
|
|
||||||
fclose(pd);
|
fclose(pd);
|
||||||
Utils::lockDownFile(pdpath.c_str(),false);
|
|
||||||
buf.burn();
|
buf.burn();
|
||||||
|
|
||||||
|
Utils::lockDownFile(pdpath.c_str(),false);
|
||||||
|
#endif // ZT_PEER_SERIALIZATION_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
void Topology::_loadPeers()
|
void Topology::_loadPeers()
|
||||||
{
|
{
|
||||||
Buffer<ZT_PEER_WRITE_BUF_SIZE> buf;
|
|
||||||
std::string pdpath(RR->homePath + ZT_PATH_SEPARATOR_S + "peers.persist");
|
std::string pdpath(RR->homePath + ZT_PATH_SEPARATOR_S + "peers.persist");
|
||||||
|
|
||||||
|
#ifdef ZT_PEER_SERIALIZATION_VERSION
|
||||||
|
Buffer<ZT_PEER_WRITE_BUF_SIZE> buf;
|
||||||
Mutex::Lock _l(_activePeers_m);
|
Mutex::Lock _l(_activePeers_m);
|
||||||
|
|
||||||
_activePeers.clear();
|
_activePeers.clear();
|
||||||
@ -374,8 +379,10 @@ void Topology::_loadPeers()
|
|||||||
}
|
}
|
||||||
|
|
||||||
fclose(pd);
|
fclose(pd);
|
||||||
Utils::rm(pdpath);
|
|
||||||
buf.burn();
|
buf.burn();
|
||||||
|
#endif // ZT_PEER_SERIALIZATION_VERSION
|
||||||
|
|
||||||
|
Utils::rm(pdpath);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ZeroTier
|
} // namespace ZeroTier
|
||||||
|
Loading…
x
Reference in New Issue
Block a user