diff --git a/lib/amf.c b/lib/amf.c index 71455da1..5d4178af 100644 --- a/lib/amf.c +++ b/lib/amf.c @@ -100,16 +100,6 @@ static struct saVersionDatabase amfVersionDatabase = { void amfHandleInstanceDestructor (void *instance) { - struct amfInstance *amfInstance = (struct amfInstance *)instance; - - if (amfInstance->response_fd != -1) { - shutdown (amfInstance->response_fd, 0); - close (amfInstance->response_fd); - } - if (amfInstance->dispatch_fd != -1) { - shutdown (amfInstance->dispatch_fd, 0); - close (amfInstance->dispatch_fd); - } } SaErrorT @@ -400,6 +390,15 @@ saAmfFinalize ( saHandleDestroy (&amfHandleDatabase, *amfHandle); + if (amfInstance->response_fd != -1) { + shutdown (amfInstance->response_fd, 0); + close (amfInstance->response_fd); + } + if (amfInstance->dispatch_fd != -1) { + shutdown (amfInstance->dispatch_fd, 0); + close (amfInstance->dispatch_fd); + } + saHandleInstancePut (&amfHandleDatabase, *amfHandle); return (error); diff --git a/lib/ckpt.c b/lib/ckpt.c index 8665ca60..80b0132e 100644 --- a/lib/ckpt.c +++ b/lib/ckpt.c @@ -142,10 +142,6 @@ void ckptHandleInstanceDestructor (void *instance) { struct ckptInstance *ckptInstance = (struct ckptInstance *)instance; - if (ckptInstance->response_fd != -1) { - shutdown (ckptInstance->response_fd, 0); - close (ckptInstance->response_fd); - } } void checkpointHandleInstanceDestructor (void *instance) @@ -434,9 +430,18 @@ saCkptFinalize ( ckptCheckpointInstance->checkpointHandle); } + saHandleDestroy (&ckptHandleDatabase, ckptHandle); + + if (ckptInstance->response_fd != -1) { + shutdown (ckptInstance->response_fd, 0); + close (ckptInstance->response_fd); + } + if (ckptInstance->dispatch_fd != -1) { + shutdown (ckptInstance->dispatch_fd, 0); + close (ckptInstance->dispatch_fd); + } saHandleInstancePut (&ckptHandleDatabase, ckptHandle); - saHandleDestroy (&ckptHandleDatabase, ckptHandle); return (SA_AIS_OK); } diff --git a/lib/clm.c b/lib/clm.c index ff1f4425..5a061339 100644 --- a/lib/clm.c +++ b/lib/clm.c @@ -90,16 +90,6 @@ static struct saVersionDatabase clmVersionDatabase = { void clmHandleInstanceDestructor (void *instance) { - struct clmInstance *clmInstance = (struct clmInstance *)instance; - - if (clmInstance->response_fd != -1) { - shutdown (clmInstance->response_fd, 0); - close (clmInstance->response_fd); - } - if (clmInstance->dispatch_fd != -1) { - shutdown (clmInstance->dispatch_fd, 0); - close (clmInstance->dispatch_fd); - } } @@ -383,6 +373,15 @@ saClmFinalize ( saHandleDestroy (&clmHandleDatabase, clmHandle); + if (clmInstance->response_fd != -1) { + shutdown (clmInstance->response_fd, 0); + close (clmInstance->response_fd); + } + if (clmInstance->dispatch_fd != -1) { + shutdown (clmInstance->dispatch_fd, 0); + close (clmInstance->dispatch_fd); + } + saHandleInstancePut (&clmHandleDatabase, clmHandle); return (error); diff --git a/lib/evs.c b/lib/evs.c index b210ade4..00bd8f8d 100644 --- a/lib/evs.c +++ b/lib/evs.c @@ -73,19 +73,6 @@ static struct saHandleDatabase evs_handle_t_db = { */ static void evs_instance_destructor (void *instance) { - struct evs_inst *evs_inst = instance; - - /* - * Disconnect from the server - */ - if (evs_inst->response_fd != -1) { - shutdown(evs_inst->response_fd, 0); - close(evs_inst->response_fd); - } - if (evs_inst->dispatch_fd != -1) { - shutdown(evs_inst->dispatch_fd, 0); - close(evs_inst->dispatch_fd); - } } @@ -157,9 +144,20 @@ evs_error_t evs_finalize ( pthread_mutex_unlock (&evs_inst->response_mutex); + saHandleDestroy (&evs_handle_t_db, handle); + /* + * Disconnect from the server + */ + if (evs_inst->response_fd != -1) { + shutdown(evs_inst->response_fd, 0); + close(evs_inst->response_fd); + } + if (evs_inst->dispatch_fd != -1) { + shutdown(evs_inst->dispatch_fd, 0); + close(evs_inst->dispatch_fd); + } saHandleInstancePut (&evs_handle_t_db, handle); - saHandleDestroy (&evs_handle_t_db, handle); return (EVS_OK); } diff --git a/lib/evt.c b/lib/evt.c index adf8f479..cc13328e 100644 --- a/lib/evt.c +++ b/lib/evt.c @@ -186,20 +186,7 @@ struct event_data_instance { */ static void evtHandleInstanceDestructor(void *instance) { - struct event_instance *evti = instance; - /* - * Disconnect from the server - */ - if (evti->ei_response_fd != -1) { - shutdown(evti->ei_response_fd, 0); - close(evti->ei_response_fd); - } - - if (evti->ei_dispatch_fd != -1) { - shutdown(evti->ei_dispatch_fd, 0); - close(evti->ei_dispatch_fd); - } } /* @@ -737,6 +724,18 @@ saEvtFinalize(SaEvtHandleT evtHandle) pthread_mutex_unlock(&evti->ei_response_mutex); saHandleDestroy(&evt_instance_handle_db, evtHandle); + /* + * Disconnect from the server + */ + if (evti->ei_response_fd != -1) { + shutdown(evti->ei_response_fd, 0); + close(evti->ei_response_fd); + } + + if (evti->ei_dispatch_fd != -1) { + shutdown(evti->ei_dispatch_fd, 0); + close(evti->ei_dispatch_fd); + } saHandleInstancePut(&evt_instance_handle_db, evtHandle); return error;