}
void
-hash_remove_by_value (struct hash *hash, void *value, bool autolock)
+hash_remove_by_value (struct hash *hash, void *value)
{
struct hash_iterator hi;
struct hash_element *he;
- hash_iterator_init (hash, &hi, autolock);
+ hash_iterator_init (hash, &hi);
while ((he = hash_iterator_next (&hi)))
{
if (he->value == value)
void
hash_iterator_init_range (struct hash *hash,
struct hash_iterator *hi,
- bool autolock,
int start_bucket,
int end_bucket)
{
hi->hash = hash;
hi->elem = NULL;
hi->bucket = NULL;
- hi->autolock = autolock;
hi->last = NULL;
hi->bucket_marked = false;
hi->bucket_index_start = start_bucket;
void
hash_iterator_init (struct hash *hash,
- struct hash_iterator *hi,
- bool autolock)
+ struct hash_iterator *hi)
{
- hash_iterator_init_range (hash, hi, autolock, 0, hash->n_buckets);
+ hash_iterator_init_range (hash, hi, 0, hash->n_buckets);
}
static inline void
const void *key,
uint32_t hv);
-void hash_remove_by_value (struct hash *hash, void *value, bool autolock);
+void hash_remove_by_value (struct hash *hash, void *value);
struct hash_iterator
{
struct hash_element *elem;
struct hash_element *last;
bool bucket_marked;
- bool autolock;
int bucket_index_start;
int bucket_index_end;
};
void hash_iterator_init_range (struct hash *hash,
struct hash_iterator *hi,
- bool autolock,
int start_bucket,
int end_bucket);
-void hash_iterator_init (struct hash *hash, struct hash_iterator *iter, bool autolock);
+void hash_iterator_init (struct hash *hash, struct hash_iterator *iter);
struct hash_element *hash_iterator_next (struct hash_iterator *hi);
void hash_iterator_delete_element (struct hash_iterator *hi);
void hash_iterator_free (struct hash_iterator *hi);
return &hash->buckets[hv & hash->mask];
}
-static inline void
-hash_bucket_lock (struct hash_bucket *bucket)
-{
-}
-
-static inline void
-hash_bucket_unlock (struct hash_bucket *bucket)
-{
-}
-
static inline void *
-hash_lookup_lock (struct hash *hash, const void *key, uint32_t hv)
+hash_lookup (struct hash *hash, const void *key)
{
void *ret = NULL;
struct hash_element *he;
+ uint32_t hv = hash_value (hash, key);
struct hash_bucket *bucket = &hash->buckets[hv & hash->mask];
he = hash_lookup_fast (hash, bucket, key, hv);
return ret;
}
-static inline void *
-hash_lookup (struct hash *hash, const void *key)
-{
- return hash_lookup_lock (hash, key, hash_value (hash, key));
-}
-
/* NOTE: assumes that key is not a duplicate */
static inline void
hash_add_fast (struct hash *hash,
}
dmsg (D_MULTI_DEBUG, "MULTI: REAP range %d -> %d", start_bucket, end_bucket);
- hash_iterator_init_range (m->vhash, &hi, true, start_bucket, end_bucket);
+ hash_iterator_init_range (m->vhash, &hi, start_bucket, end_bucket);
while ((he = hash_iterator_next (&hi)) != NULL)
{
struct multi_route *r = (struct multi_route *) he->value;
struct hash_iterator hi;
struct hash_element *he;
- hash_iterator_init (m->iter, &hi, true);
+ hash_iterator_init (m->iter, &hi);
while ((he = hash_iterator_next (&hi)))
{
struct multi_instance *mi = (struct multi_instance *) he->value;
status_printf (so, PACKAGE_NAME " CLIENT LIST");
status_printf (so, "Updated,%s", time_string (0, 0, false, &gc_top));
status_printf (so, "Common Name,Real Address,Bytes Received,Bytes Sent,Connected Since");
- hash_iterator_init (m->hash, &hi, true);
+ hash_iterator_init (m->hash, &hi);
while ((he = hash_iterator_next (&hi)))
{
struct gc_arena gc = gc_new ();
status_printf (so, "ROUTING TABLE");
status_printf (so, "Virtual Address,Common Name,Real Address,Last Ref");
- hash_iterator_init (m->vhash, &hi, true);
+ hash_iterator_init (m->vhash, &hi);
while ((he = hash_iterator_next (&hi)))
{
struct gc_arena gc = gc_new ();
status_printf (so, "TIME%c%s%c%u", sep, time_string (now, 0, false, &gc_top), sep, (unsigned int)now);
status_printf (so, "HEADER%cCLIENT_LIST%cCommon Name%cReal Address%cVirtual Address%cBytes Received%cBytes Sent%cConnected Since%cConnected Since (time_t)",
sep, sep, sep, sep, sep, sep, sep, sep);
- hash_iterator_init (m->hash, &hi, true);
+ hash_iterator_init (m->hash, &hi);
while ((he = hash_iterator_next (&hi)))
{
struct gc_arena gc = gc_new ();
status_printf (so, "HEADER%cROUTING_TABLE%cVirtual Address%cCommon Name%cReal Address%cLast Ref%cLast Ref (time_t)",
sep, sep, sep, sep, sep, sep);
- hash_iterator_init (m->vhash, &hi, true);
+ hash_iterator_init (m->vhash, &hi);
while ((he = hash_iterator_next (&hi)))
{
struct gc_arena gc = gc_new ();
#ifdef PACKET_TRUNCATION_CHECK
{
status_printf (so, "HEADER,ERRORS,Common Name,TUN Read Trunc,TUN Write Trunc,Pre-encrypt Trunc,Post-decrypt Trunc");
- hash_iterator_init (m->hash, &hi, true);
+ hash_iterator_init (m->hash, &hi);
while ((he = hash_iterator_next (&hi)))
{
struct gc_arena gc = gc_new ();
struct multi_route *oldroute = NULL;
struct multi_instance *owner = NULL;
- hash_bucket_lock (bucket);
-
/* if route currently exists, get the instance which owns it */
he = hash_lookup_fast (m->vhash, bucket, addr, hv);
if (he)
gc_free (&gc);
}
- hash_bucket_unlock (bucket);
return owner;
}
struct hash_element *he;
int count = 0;
- hash_iterator_init (m->iter, &hi, true);
+ hash_iterator_init (m->iter, &hi);
while ((he = hash_iterator_next (&hi)))
{
struct multi_instance *mi = (struct multi_instance *) he->value;
printf ("BCAST len=%d\n", BLEN (buf));
#endif
mb = mbuf_alloc_buf (buf);
- hash_iterator_init (m->iter, &hi, true);
+ hash_iterator_init (m->iter, &hi);
while ((he = hash_iterator_next (&hi)))
{
struct hash_element *he;
int count = 0;
- hash_iterator_init (m->iter, &hi, true);
+ hash_iterator_init (m->iter, &hi);
while ((he = hash_iterator_next (&hi)))
{
struct multi_instance *mi = (struct multi_instance *) he->value;
saddr.sa.sin_port = htons (port);
if (mroute_extract_openvpn_sockaddr (&maddr, &saddr, true))
{
- hash_iterator_init (m->iter, &hi, true);
+ hash_iterator_init (m->iter, &hi);
while ((he = hash_iterator_next (&hi)))
{
struct multi_instance *mi = (struct multi_instance *) he->value;