Shared memory logic fix for quick disconnecting users

This commit is contained in:
Thulinma 2019-01-09 09:29:19 +01:00
parent 94f83a1775
commit 0a1b00cb5e

View file

@ -1001,10 +1001,12 @@ namespace IPC {
amount = lastFilled+1; amount = lastFilled+1;
VERYHIGH_MSG("Shared memory %s is now at count %u", baseName.c_str(), amount); VERYHIGH_MSG("Shared memory %s is now at count %u", baseName.c_str(), amount);
} }
if (id >= amount + 100) {
//stop, we're guaranteed no more pages are full at this point //stop, we're guaranteed no more pages are full at this point
break; break;
} }
} }
}
} else { } else {
if (memcmp(empty, it->mapped + offset, payLen)) { if (memcmp(empty, it->mapped + offset, payLen)) {
++userCount; ++userCount;
@ -1023,6 +1025,7 @@ namespace IPC {
amount = lastFilled+1; amount = lastFilled+1;
VERYHIGH_MSG("Shared memory %s is now at count %u", baseName.c_str(), amount); VERYHIGH_MSG("Shared memory %s is now at count %u", baseName.c_str(), amount);
} }
if (id >= amount + 100) {
//stop, we're guaranteed no more pages are full at this point //stop, we're guaranteed no more pages are full at this point
if (empty) { if (empty) {
free(empty); free(empty);
@ -1031,6 +1034,7 @@ namespace IPC {
} }
} }
} }
}
offset += payLen + (hasCounter ? 1 : 0); offset += payLen + (hasCounter ? 1 : 0);
id ++; id ++;
} }