/*
- * Copyright (C) 2008-2016 Tobias Brunner
+ * Copyright (C) 2008-2019 Tobias Brunner
* HSR Hochschule fuer Technik Rapperswil
*
* Copyright (C) 2010 Martin Willi
*/
hashtable_t *reqids_by_ts;
+ /**
+ * Previously used reqids that have been released
+ */
+ array_t *released_reqids;
+
/**
* mutex for algorithm mappings
*/
{
/* none found, create a new entry, allocating a reqid */
entry = tmpl;
- entry->reqid = ++counter;
+ if (!array_remove(this->released_reqids, ARRAY_HEAD, &entry->reqid))
+ {
+ entry->reqid = ++counter;
+ }
this->reqids_by_ts->put(this->reqids_by_ts, entry, entry);
this->reqids->put(this->reqids, entry, entry);
}
{
if (--entry->refs == 0)
{
+ array_insert_create_value(&this->released_reqids, sizeof(uint32_t),
+ ARRAY_TAIL, &entry->reqid);
entry = this->reqids_by_ts->remove(this->reqids_by_ts, entry);
if (entry)
{
DESTROY_FUNCTION_IF(this->ifaces_filter, (void*)free);
this->reqids->destroy(this->reqids);
this->reqids_by_ts->destroy(this->reqids_by_ts);
+ array_destroy(this->released_reqids);
this->listeners->destroy(this->listeners);
this->mutex->destroy(this->mutex);
free(this);