Sfoglia il codice sorgente

coroipcc_dispatch_get(): Fix --enable-small-memory-footprint support

Signed-off-by: Jerome Flesch <jerome.flesch@netasq.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Jerome Flesch 14 anni fa
parent
commit
795aa5e24c
1 ha cambiato i file con 12 aggiunte e 1 eliminazioni
  1. 12 1
      lib/coroipcc.c

+ 12 - 1
lib/coroipcc.c

@@ -847,6 +847,17 @@ coroipcc_dispatch_get (
 		return (error);
 	}
 
+	if (shared_mem_dispatch_bytes_left (ipc_instance) > (ipc_instance->dispatch_size/2)) {
+		/*
+		 * Notify coroipcs to flush any pending dispatch messages
+		 */
+		res = ipc_sem_post (ipc_instance->control_buffer, SEMAPHORE_REQUEST_OR_FLUSH_OR_EXIT);
+		if (res != CS_OK) {
+			error = CS_ERR_LIBRARY;
+			goto error_put;
+		}
+	}
+
 	*data = NULL;
 
 	ufds.fd = ipc_instance->fd;
@@ -881,7 +892,7 @@ coroipcc_dispatch_get (
 #endif
 	assert (error == CS_OK);
 
-	if (shared_mem_dispatch_bytes_left (ipc_instance) > 500000) {
+	if (shared_mem_dispatch_bytes_left (ipc_instance) > (ipc_instance->dispatch_size/2)) {
 		/*
 		 * Notify coroipcs to flush any pending dispatch messages
 		 */