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

mesos git commit: Abort if Future::failure() is called on non-failed Future

Repository: mesos
Updated Branches:
  refs/heads/master aff148e15 -> 6486f522d


Abort if Future::failure() is called on non-failed Future

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


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

Branch: refs/heads/master
Commit: 6486f522df1494e50951e0095d98b7070d9e174f
Parents: aff148e
Author: Dominic Hamon <dh...@twitter.com>
Authored: Mon Nov 10 13:58:19 2014 -0800
Committer: Dominic Hamon <dh...@twitter.com>
Committed: Mon Nov 10 14:41:46 2014 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/include/process/future.hpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/6486f522/3rdparty/libprocess/include/process/future.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/future.hpp b/3rdparty/libprocess/include/process/future.hpp
index 46ae16b..bc8b878 100644
--- a/3rdparty/libprocess/include/process/future.hpp
+++ b/3rdparty/libprocess/include/process/future.hpp
@@ -24,6 +24,7 @@
 #include <process/pid.hpp>
 #include <process/timer.hpp>
 
+#include <stout/abort.hpp>
 #include <stout/duration.hpp>
 #include <stout/error.hpp>
 #include <stout/lambda.hpp>
@@ -1171,10 +1172,10 @@ const T& Future<T>::get() const
 template <typename T>
 std::string Future<T>::failure() const
 {
-  if (data->message != NULL) {
-    return *data->message;
+  if (data->state != FAILED) {
+    ABORT("Future::failure() but state != FAILED");
   }
-  return "";
+  return *(CHECK_NOTNULL(data->message));
 }