diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-10-13 15:47:55 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-10-13 15:47:55 +0200 |
commit | 20921b8300d1699d8b0133b3f5fc360fdd99fc0d (patch) | |
tree | 5192d254611ec919edf4596152ed5c041463acf2 /src/lib | |
parent | 550e7892e47cf8daf351eb773ef3900b33ecabae (diff) | |
download | ouroboros-20921b8300d1699d8b0133b3f5fc360fdd99fc0d.tar.gz ouroboros-20921b8300d1699d8b0133b3f5fc360fdd99fc0d.zip |
lib: Fix flow deallocation logic
Both the N and N-1 entity must now call flow_dealloc for the port_id
to be released.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/dev.c | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c index c1f769ad..348b864c 100644 --- a/src/lib/dev.c +++ b/src/lib/dev.c @@ -566,11 +566,10 @@ int flow_dealloc(int fd) shm_ap_rbuff_close_port(ai.rb, msg.port_id); pthread_rwlock_unlock(&ai.flows_lock); + pthread_rwlock_unlock(&ai.data_lock); send_irm_msg(&msg); - pthread_rwlock_unlock(&ai.data_lock); - return 0; } @@ -864,22 +863,6 @@ int np1_flow_dealloc(int port_id) pthread_rwlock_wrlock(&ai.flows_lock); fd = ai.ports[port_id].fd; - if (fd < 0) { - pthread_rwlock_unlock(&ai.flows_lock); - pthread_rwlock_unlock(&ai.data_lock); - return fd; - } - - ai.flows[fd].port_id = -1; - shm_ap_rbuff_close(ai.flows[fd].rb); - ai.flows[fd].rb = NULL; - ai.flows[fd].api = -1; - - bmp_release(ai.fds, fd); - - port_destroy(&ai.ports[port_id]); - - shm_ap_rbuff_close_port(ai.rb, port_id); pthread_rwlock_unlock(&ai.flows_lock); pthread_rwlock_unlock(&ai.data_lock); |