From 94f83a1775329abef5930c91d0d55062edc8d31c Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 8 Jan 2019 22:21:24 +0100 Subject: [PATCH 1/2] Silenced overwriting page error message for 1-byte sized pages --- lib/shared_memory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/shared_memory.cpp b/lib/shared_memory.cpp index 6da6525b..2f69a4e6 100644 --- a/lib/shared_memory.cpp +++ b/lib/shared_memory.cpp @@ -448,7 +448,7 @@ namespace IPC { handle = shm_open(name.c_str(), (master ? O_CREAT | O_EXCL : 0) | O_RDWR, ACCESSPERMS); if (handle == -1) { if (master) { - ERROR_MSG("Overwriting old page for %s", name.c_str()); + if (len > 1){ERROR_MSG("Overwriting old page for %s", name.c_str());} handle = shm_open(name.c_str(), O_CREAT | O_RDWR, ACCESSPERMS); } else { int i = 0; From 0a1b00cb5e948ca5d133f14cefaa27d4d91b7e45 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Wed, 9 Jan 2019 09:29:19 +0100 Subject: [PATCH 2/2] Shared memory logic fix for quick disconnecting users --- lib/shared_memory.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/shared_memory.cpp b/lib/shared_memory.cpp index 2f69a4e6..fafbccd7 100644 --- a/lib/shared_memory.cpp +++ b/lib/shared_memory.cpp @@ -1001,8 +1001,10 @@ namespace IPC { amount = lastFilled+1; VERYHIGH_MSG("Shared memory %s is now at count %u", baseName.c_str(), amount); } - //stop, we're guaranteed no more pages are full at this point - break; + if (id >= amount + 100) { + //stop, we're guaranteed no more pages are full at this point + break; + } } } } else { @@ -1023,11 +1025,13 @@ namespace IPC { amount = lastFilled+1; VERYHIGH_MSG("Shared memory %s is now at count %u", baseName.c_str(), amount); } - //stop, we're guaranteed no more pages are full at this point - if (empty) { - free(empty); + if (id >= amount + 100) { + //stop, we're guaranteed no more pages are full at this point + if (empty) { + free(empty); + } + break; } - break; } } }