mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-09 12:11:15 +00:00
add INCOMING_PACKET_CONCURRENCY environment variable to be able to specify max threads for receive in controller
This commit is contained in:
parent
56a58f2b11
commit
4a89729529
@ -607,7 +607,17 @@ public:
|
||||
_ports[1] = 0;
|
||||
_ports[2] = 0;
|
||||
|
||||
_incomingPacketConcurrency = std::max((unsigned long)1,std::min((unsigned long)16,(unsigned long)std::thread::hardware_concurrency()));
|
||||
char *envPool = std::getenv("INCOMING_PACKET_CONCURRENCY");
|
||||
if (envPool != NULL) {
|
||||
int tmp = atoi(envPool);
|
||||
if (tmp > 0) {
|
||||
_incomingPacketConcurrency = tmp;
|
||||
} else {
|
||||
_incomingPacketConcurrency = std::max((unsigned long)1,std::min((unsigned long)16,(unsigned long)std::thread::hardware_concurrency()));
|
||||
}
|
||||
} else {
|
||||
_incomingPacketConcurrency = std::max((unsigned long)1,std::min((unsigned long)16,(unsigned long)std::thread::hardware_concurrency()));
|
||||
}
|
||||
for(long t=0;t<_incomingPacketConcurrency;++t) {
|
||||
_incomingPacketThreads.push_back(std::thread([this]() {
|
||||
OneServiceIncomingPacket *pkt = nullptr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user