mesos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mp...@apache.org
Subject [2/2] mesos git commit: Use explicit error codes in `ErrnoError` and `SocketError`.
Date Thu, 17 Nov 2016 23:52:12 GMT
Use explicit error codes in `ErrnoError` and `SocketError`.

Pass the error code down to the `Error` object explicitly, rather than
setting the per-thread error and using it implicitly.

Review: https://reviews.apache.org/r/53475/


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/86303ed3
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/86303ed3
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/86303ed3

Branch: refs/heads/master
Commit: 86303ed30832ec919bd51d125dc330d969f58b8b
Parents: 18ec7af
Author: James Peach <jpeach@apache.org>
Authored: Thu Nov 17 13:35:32 2016 -0800
Committer: Michael Park <mpark@apache.org>
Committed: Thu Nov 17 13:37:47 2016 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/libevent_ssl_socket.cpp |  3 +--
 3rdparty/libprocess/src/poll_socket.cpp         | 12 +-----------
 2 files changed, 2 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/86303ed3/3rdparty/libprocess/src/libevent_ssl_socket.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/libevent_ssl_socket.cpp b/3rdparty/libprocess/src/libevent_ssl_socket.cpp
index 21f878e..5c0929d 100644
--- a/3rdparty/libprocess/src/libevent_ssl_socket.cpp
+++ b/3rdparty/libprocess/src/libevent_ssl_socket.cpp
@@ -163,8 +163,7 @@ Try<Nothing> LibeventSSLSocketImpl::shutdown()
       CHECK(recv_request.get() == nullptr);
       CHECK(send_request.get() == nullptr);
 
-      errno = ENOTCONN;
-      return ErrnoError();
+      return ErrnoError(ENOTCONN);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/mesos/blob/86303ed3/3rdparty/libprocess/src/poll_socket.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/poll_socket.cpp b/3rdparty/libprocess/src/poll_socket.cpp
index f0ee149..eb7b487 100644
--- a/3rdparty/libprocess/src/poll_socket.cpp
+++ b/3rdparty/libprocess/src/poll_socket.cpp
@@ -131,17 +131,7 @@ Future<Nothing> connect(const Socket& socket, const Address&
to)
   }
 
   if (opt != 0) {
-    // Make the error visible to the `SocketError` constructor by pushing
-    // it into the global per-thread error. MESOS-6520 which should
-    // allow us to pass the error code directly into `SocketError`.
-
-#ifdef __WINDOWS__
-    ::WSASetLastError(opt);
-#else
-    errno = opt;
-#endif
-
-    return Failure(SocketError("Failed to connect to " + stringify(to)));
+    return Failure(SocketError(opt, "Failed to connect to " + stringify(to)));
   }
 
   return Nothing();


Mime
View raw message