0...1000 is the key range

This commit is contained in:
simon.kagstrom 2010-02-07 14:24:50 +00:00
parent 56c4742f75
commit 3a83b3f66a

View File

@ -8,8 +8,7 @@ DataStore::DataStore()
this->registeredData = NULL; this->registeredData = NULL;
this->n_registeredData = 0; this->n_registeredData = 0;
/* Convention: Odd numbers for the clients */ this->key_counter = 0;
this->key_counter = 1;
} }
DataStore::~DataStore() DataStore::~DataStore()
@ -72,10 +71,10 @@ uint32_t DataStore::getNextKey()
{ {
uint32_t out = this->key_counter; uint32_t out = this->key_counter;
this->key_counter += 2; this->key_counter++;
if (this->key_counter > DATA_KEY_RANGE) if (this->key_counter >= DATA_KEY_RANGE)
this->key_counter = 1; this->key_counter = 0;
return out; return out;
} }