$SUBJ$

Regards,
  Honza
commit 5b92559e1a80c997d32c1ec96a8768ab4aea9917
Author: Jan Friesse <[email protected]>
Date:   Tue Sep 7 17:49:21 2010 +0200

    Remove delay in library on corosync shutdown
    
    Patch removes 2 seconds delay in library on normal corosync shutdown.
    Delay is still present on abnormal shutdown.

diff --git a/trunk/exec/coroipcs.c b/trunk/exec/coroipcs.c
index f246c8f..0ca22d3 100644
--- a/trunk/exec/coroipcs.c
+++ b/trunk/exec/coroipcs.c
@@ -547,6 +547,13 @@ static inline int conn_info_destroy (struct conn_info 
*conn_info)
        list_del (&conn_info->list);
        pthread_mutex_unlock (&conn_info->mutex);
 
+       /*
+        * Let library know, that connection is now closed
+        */
+       conn_info->control_buffer->ipc_closed = 1;
+       ipc_sem_post (conn_info->control_buffer, SEMAPHORE_RESPONSE);
+       ipc_sem_post (conn_info->control_buffer, SEMAPHORE_DISPATCH);
+
 #if _POSIX_THREAD_PROCESS_SHARED > 0
        sem_destroy (&conn_info->control_buffer->sem_request_or_flush_or_exit);
        sem_destroy (&conn_info->control_buffer->sem_request);
diff --git a/trunk/include/corosync/coroipc_ipc.h 
b/trunk/include/corosync/coroipc_ipc.h
index c3c2d23..dadc34f 100644
--- a/trunk/include/corosync/coroipc_ipc.h
+++ b/trunk/include/corosync/coroipc_ipc.h
@@ -92,6 +92,7 @@ struct control_buffer {
 #else
        int semid;
 #endif
+       int ipc_closed;
 };
 
 enum res_init_types {
@@ -202,7 +203,11 @@ retry_sem_wait:
                if (res == -1) {
                        return (CS_ERR_LIBRARY);
                }
-       } else { 
+       } else {
+               if (control_buffer->ipc_closed) {
+                       return (CS_ERR_LIBRARY);
+               }
+
                timeout.tv_sec = time(NULL) + IPC_SEMWAIT_TIMEOUT;
                timeout.tv_nsec = 0;
 
@@ -243,6 +248,10 @@ retry_poll:
                if (res == -1) {
                        return (CS_ERR_LIBRARY);
                }
+
+               if (res == 0 && control_buffer->ipc_closed) {
+                       return (CS_ERR_LIBRARY);
+               }
        }
 #else
        sop.sem_num = sem_id;
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to