Last active
February 26, 2020 20:46
-
-
Save Amanieu/f99fe9a7557cdbacb085d8e4efbbb8d4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/common/IPC/Primitives.cpp b/src/common/IPC/Primitives.cpp | |
index c348776e..6d48f779 100644 | |
--- a/src/common/IPC/Primitives.cpp | |
+++ b/src/common/IPC/Primitives.cpp | |
@@ -302,13 +302,16 @@ void Socket::SendMsg(const Util::Writer& writer) const | |
const void* data = writer.GetData().data(); | |
size_t len = writer.GetData().size(); | |
+ // Use a smaller buffer size to avoid ENOBUFS errors from the kernel | |
+ const size_t MAX_IPC_BYTES = 4096; | |
+ | |
while (numHandles || len) { | |
- bool more = numHandles > NACL_ABI_IMC_DESC_MAX || len > NACL_ABI_IMC_USER_BYTES_MAX - 1; | |
- InternalSendMsg(handle, more, handles, std::min<size_t>(numHandles, NACL_ABI_IMC_DESC_MAX), data, std::min<size_t>(len, NACL_ABI_IMC_USER_BYTES_MAX - 1)); | |
+ bool more = numHandles > NACL_ABI_IMC_DESC_MAX || len > MAX_IPC_BYTES; | |
+ InternalSendMsg(handle, more, handles, std::min<size_t>(numHandles, NACL_ABI_IMC_DESC_MAX), data, std::min<size_t>(len, MAX_IPC_BYTES)); | |
handles += std::min<size_t>(numHandles, NACL_ABI_IMC_DESC_MAX); | |
numHandles -= std::min<size_t>(numHandles, NACL_ABI_IMC_DESC_MAX); | |
- data = static_cast<const char*>(data) + std::min<size_t>(len, NACL_ABI_IMC_USER_BYTES_MAX - 1); | |
- len -= std::min<size_t>(len, NACL_ABI_IMC_USER_BYTES_MAX - 1); | |
+ data = static_cast<const char*>(data) + std::min<size_t>(len, MAX_IPC_BYTES); | |
+ len -= std::min<size_t>(len, MAX_IPC_BYTES); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment