You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by jo...@apache.org on 2016/10/24 23:19:11 UTC

[7/8] mesos git commit: Libprocess Reinit: Changed Socket::DEFAULT_KIND to a non-static value.

Libprocess Reinit: Changed Socket::DEFAULT_KIND to a non-static value.

This is needed for tests that utilize the test-only
`process::reinitialize` function.

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


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

Branch: refs/heads/master
Commit: 03c79ab35e2cbb2e319cb81197ecfff5e60268b8
Parents: 3e3aeb2
Author: Joseph Wu <jo...@mesosphere.io>
Authored: Mon Oct 24 15:06:41 2016 -0700
Committer: Joseph Wu <jo...@apache.org>
Committed: Mon Oct 24 16:18:51 2016 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/socket.hpp |  2 +-
 3rdparty/libprocess/src/socket.cpp             | 11 +++++------
 2 files changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/03c79ab3/3rdparty/libprocess/include/process/socket.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/socket.hpp b/3rdparty/libprocess/include/process/socket.hpp
index 67551a9..f798af7 100644
--- a/3rdparty/libprocess/include/process/socket.hpp
+++ b/3rdparty/libprocess/include/process/socket.hpp
@@ -77,7 +77,7 @@ public:
    *
    * @see process::network::Socket::Kind
    */
-  static const Kind& DEFAULT_KIND();
+  static Kind DEFAULT_KIND();
 
   /**
    * Returns the kind representing the underlying implementation

http://git-wip-us.apache.org/repos/asf/mesos/blob/03c79ab3/3rdparty/libprocess/src/socket.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/socket.cpp b/3rdparty/libprocess/src/socket.cpp
index 6089248..7f93168 100644
--- a/3rdparty/libprocess/src/socket.cpp
+++ b/3rdparty/libprocess/src/socket.cpp
@@ -102,16 +102,15 @@ Try<Socket> Socket::create(Kind kind, Option<int> s)
 }
 
 
-const Socket::Kind& Socket::DEFAULT_KIND()
+Socket::Kind Socket::DEFAULT_KIND()
 {
-  static const Kind DEFAULT =
+  // NOTE: Some tests may change the OpenSSL flags and reinitialize
+  // libprocess. In non-test code, the return value should be constant.
 #ifdef USE_SSL_SOCKET
-      network::openssl::flags().enabled ? Socket::SSL : Socket::POLL;
+      return network::openssl::flags().enabled ? Socket::SSL : Socket::POLL;
 #else
-      Socket::POLL;
+      return Socket::POLL;
 #endif
-
-  return DEFAULT;
 }