Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(460)

Unified Diff: ipc/unix_domain_socket_util.cc

Issue 1632133003: ipc: hide IsRecoverableError() function behind unnamed namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/unix_domain_socket_util.cc
diff --git a/ipc/unix_domain_socket_util.cc b/ipc/unix_domain_socket_util.cc
index 036faa2dccc9def09b8010b9029df0a7dd65e7e2..bfc7399ebb28bba68b4186ac78d6cdf70224e34e 100644
--- a/ipc/unix_domain_socket_util.cc
+++ b/ipc/unix_domain_socket_util.cc
@@ -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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698