mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-20 08:21:56 +09:00
[MG_Remote, MG_Test, scripts] (P7): bound the pre-auth cap and pause accepting when out of descriptors
This commit is contained in:
@@ -486,7 +486,13 @@ namespace MobileGL::MG_Remote::Transport {
|
||||
if (fd < 0) {
|
||||
// The same two non-failures AcceptPair re-polls on.
|
||||
if (errno == EINTR || errno == ECONNABORTED) continue;
|
||||
WireLogError("MG_Remote SocketTransport: accept failed: %s", std::strerror(errno));
|
||||
const int error = errno;
|
||||
WireLogError("MG_Remote SocketTransport: accept failed: %s", std::strerror(error));
|
||||
// Out of descriptors or memory is the PROCESS's state, not the listener's: the
|
||||
// connection waits in the backlog (f2-auth fix round; the TCP supervisor pauses
|
||||
// and retries instead of exiting 73).
|
||||
if (error == EMFILE || error == ENFILE || error == ENOBUFS || error == ENOMEM)
|
||||
return MOBILEGL_ERR_OUT_OF_MEMORY;
|
||||
return MOBILEGL_ERR_TRANSPORT_CLOSED;
|
||||
}
|
||||
::fcntl(fd, F_SETFD, FD_CLOEXEC);
|
||||
|
||||
@@ -123,6 +123,10 @@ namespace MobileGL::MG_Remote::Transport {
|
||||
static MobileGLResult ConnectDataConnection(const std::string& path, std::uint32_t timeoutMs,
|
||||
MobileGLByteSpan firstFrame, int* outFd);
|
||||
// Accepts ONE connection (TCP options applied, CLOEXEC). MOBILEGL_ERR_TIMEOUT when none.
|
||||
// MOBILEGL_ERR_OUT_OF_MEMORY when accept(2) ran out of descriptors or memory (EMFILE,
|
||||
// ENFILE, ENOBUFS, ENOMEM): the connection stays in the backlog and the listener is fine,
|
||||
// so a caller that serves many peers can wait and try again (the TCP supervisor does);
|
||||
// TRANSPORT_CLOSED for every other failure.
|
||||
static MobileGLResult AcceptOne(int listenFd, std::uint32_t timeoutMs, int* outFd);
|
||||
// Reads EXACTLY one framed message from a raw socket - the header, then the payload,
|
||||
// and not one byte more. A DataBind is followed on the same connection by StreamLink's
|
||||
|
||||
Reference in New Issue
Block a user