diff options
author | Sander Vrijders <[email protected]> | 2017-03-28 08:38:05 +0000 |
---|---|---|
committer | dimitri staessens <[email protected]> | 2017-03-28 08:38:05 +0000 |
commit | ba13c05b8b61365ff9e969c15affd2e1d52b76ed (patch) | |
tree | baa5d6178914dd12106845ca81c81b63e4249c6f /src/ipcpd/normal/pff.c | |
parent | 7ee6dadd39f3d4b5874d23bfcdcdd66eb195124e (diff) | |
parent | 6d080d9b9ee2e480717935e4ce94870fc87ea5f7 (diff) | |
download | ouroboros-ba13c05b8b61365ff9e969c15affd2e1d52b76ed.tar.gz ouroboros-ba13c05b8b61365ff9e969c15affd2e1d52b76ed.zip |
Merged in sandervrijders/ouroboros/be-upd-graph (pull request #426)
Be upd graph
Diffstat (limited to 'src/ipcpd/normal/pff.c')
-rw-r--r-- | src/ipcpd/normal/pff.c | 20 |
1 files changed, 1 insertions, 19 deletions
diff --git a/src/ipcpd/normal/pff.c b/src/ipcpd/normal/pff.c index 77c2c551..c26c2263 100644 --- a/src/ipcpd/normal/pff.c +++ b/src/ipcpd/normal/pff.c @@ -60,9 +60,7 @@ void pff_destroy(struct pff * instance) { assert(instance); - pthread_mutex_lock(&instance->lock); htable_destroy(instance->table); - pthread_mutex_unlock(&instance->lock); pthread_mutex_destroy(&instance->lock); free(instance); @@ -89,13 +87,10 @@ int pff_add(struct pff * instance, uint64_t addr, int fd) return -ENOMEM; *val = fd; - pthread_mutex_lock(&instance->lock); if (htable_insert(instance->table, addr, val)) { - pthread_mutex_unlock(&instance->lock); free(val); return -1; } - pthread_mutex_unlock(&instance->lock); return 0; } @@ -111,19 +106,15 @@ int pff_update(struct pff * instance, uint64_t addr, int fd) return -ENOMEM; *val = fd; - pthread_mutex_lock(&instance->lock); if (htable_delete(instance->table, addr)) { - pthread_mutex_unlock(&instance->lock); free(val); return -1; } if (htable_insert(instance->table, addr, val)) { - pthread_mutex_unlock(&instance->lock); free(val); return -1; } - pthread_mutex_unlock(&instance->lock); return 0; } @@ -132,12 +123,8 @@ int pff_remove(struct pff * instance, uint64_t addr) { assert(instance); - pthread_mutex_lock(&instance->lock); - if (htable_delete(instance->table, addr)) { - pthread_mutex_unlock(&instance->lock); + if (htable_delete(instance->table, addr)) return -1; - } - pthread_mutex_unlock(&instance->lock); return 0; } @@ -146,9 +133,7 @@ void pff_flush(struct pff * instance) { assert(instance); - pthread_mutex_lock(&instance->lock); htable_flush(instance->table); - pthread_mutex_unlock(&instance->lock); } int pff_nhop(struct pff * instance, uint64_t addr) @@ -158,14 +143,11 @@ int pff_nhop(struct pff * instance, uint64_t addr) assert(instance); - pthread_mutex_lock(&instance->lock); j = (int *) htable_lookup(instance->table, addr); if (j == NULL) { - pthread_mutex_unlock(&instance->lock); return -1; } fd = *j; - pthread_mutex_unlock(&instance->lock); return fd; } |