mirror of
https://git.proxmox.com/git/mirror_corosync
synced 2025-08-14 21:22:36 +00:00
Move the closing of file descriptors from the destructor to
the finalize function. This allows threads waiting on poll to wake up and release handle references. (Logical change 1.205) git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@662 fd59a12c-fef9-0310-b244-a6a79926bd2f
This commit is contained in:
parent
b3767775c4
commit
bf199836cf
19
lib/amf.c
19
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);
|
||||
|
15
lib/ckpt.c
15
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);
|
||||
}
|
||||
|
19
lib/clm.c
19
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);
|
||||
|
26
lib/evs.c
26
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);
|
||||
}
|
||||
|
25
lib/evt.c
25
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;
|
||||
|
Loading…
Reference in New Issue
Block a user