Commit 5586fa79 authored by tfarina's avatar tfarina Committed by Commit bot

ipc: hide IsRecoverableError() function behind unnamed namespace

This moves this free function inside an unnamed namespace (making its
symbol t instead of T, and thus hidding it from global) and while at
it removes its unused |err| parameter.

BUG=None
TEST=ipc_tests
R=cpu@chromium.org

Review URL: https://codereview.chromium.org/1632133003

Cr-Commit-Position: refs/heads/master@{#371600}
parent 37b82ee7
......@@ -6,7 +6,6 @@
#include <errno.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
#include <unistd.h>
......@@ -67,6 +66,11 @@ int MakeUnixAddrForPath(const std::string& socket_name,
return fd.release();
}
bool IsRecoverableError() {
return errno == ECONNABORTED || errno == EMFILE || errno == ENFILE ||
errno == ENOMEM || errno == ENOBUFS;
}
} // namespace
bool CreateServerUnixDomainSocket(const base::FilePath& socket_path,
......@@ -172,18 +176,13 @@ bool IsPeerAuthorized(int peer_fd) {
return true;
}
bool IsRecoverableError(int err) {
return errno == ECONNABORTED || errno == EMFILE || errno == ENFILE ||
errno == ENOMEM || errno == ENOBUFS;
}
bool ServerAcceptConnection(int server_listen_fd, int* server_socket) {
DCHECK(server_socket);
*server_socket = -1;
base::ScopedFD accept_fd(HANDLE_EINTR(accept(server_listen_fd, NULL, 0)));
if (!accept_fd.is_valid())
return IsRecoverableError(errno);
return IsRecoverableError();
if (!base::SetNonBlocking(accept_fd.get())) {
PLOG(ERROR) << "base::SetNonBlocking() failed " << accept_fd.get();
// It's safe to keep listening on |server_listen_fd| even if the attempt to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment