mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +02:00
Packet ID fix
This commit is contained in:
parent
2deaaeef28
commit
53a2de98de
1 changed files with 2 additions and 2 deletions
|
@ -945,8 +945,8 @@ uint64_t Packet::nextPacketId()
|
||||||
lock.lock();
|
lock.lock();
|
||||||
while (ctr == 0) {
|
while (ctr == 0) {
|
||||||
Utils::getSecureRandom(&ctr,sizeof(ctr));
|
Utils::getSecureRandom(&ctr,sizeof(ctr));
|
||||||
ctr <<= 32;
|
ctr >>= 32;
|
||||||
ctr |= ((uint64_t)time(nullptr)) & 0x00000000ffffffffULL;
|
ctr |= (((uint64_t)time(nullptr)) & 0xffffffffULL) << 32;
|
||||||
}
|
}
|
||||||
const uint64_t i = ctr++;
|
const uint64_t i = ctr++;
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
|
|
Loading…
Add table
Reference in a new issue