Skip to content
Snippets Groups Projects
Commit 36da72b6 authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

datatransfer: generate unique transfer ids

- simplifies client implementations
- can be used as a persistent id for future tracking of unfinished transfers

Change-Id: Ib03b2e2a5ec196735a0e21bdc99801894d9dfabe
parent f85e8ac8
No related branches found
No related tags found
No related merge requests found
......@@ -39,13 +39,16 @@
#include <atomic>
#include <cstdlib> // mkstemp
#include <opendht/rng.h>
namespace ring {
static DRing::DataTransferId
generateUID()
{
static DRing::DataTransferId lastId = 0;
return lastId++;
thread_local dht::crypto::random_device rd;
std::uniform_int_distribution<DRing::DataTransferId> dist;
return dist(rd);
}
//==============================================================================
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment