From 20921b8300d1699d8b0133b3f5fc360fdd99fc0d Mon Sep 17 00:00:00 2001 From: dimitri staessens Date: Thu, 13 Oct 2016 15:47:55 +0200 Subject: lib: Fix flow deallocation logic Both the N and N-1 entity must now call flow_dealloc for the port_id to be released. --- src/lib/dev.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) (limited to 'src/lib/dev.c') 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); -- cgit v1.2.3