You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2014/04/13 01:37:34 UTC
[5/5] git commit: Used Future::after in Network.
Used Future::after in Network.
Review: https://reviews.apache.org/r/19674
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/58241c03
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/58241c03
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/58241c03
Branch: refs/heads/master
Commit: 58241c03215749fbb7452cd2f8db6b5428055753
Parents: dcff80c
Author: Benjamin Hindman <be...@gmail.com>
Authored: Tue Mar 11 20:44:54 2014 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sat Apr 12 17:35:37 2014 -0600
----------------------------------------------------------------------
src/log/network.hpp | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/58241c03/src/log/network.hpp
----------------------------------------------------------------------
diff --git a/src/log/network.hpp b/src/log/network.hpp
index 488ed49..788d9eb 100644
--- a/src/log/network.hpp
+++ b/src/log/network.hpp
@@ -29,7 +29,6 @@
#include <process/collect.hpp>
#include <process/executor.hpp>
#include <process/protobuf.hpp>
-#include <process/timeout.hpp>
#include <stout/duration.hpp>
#include <stout/foreach.hpp>
@@ -118,6 +117,15 @@ public:
private:
typedef ZooKeeperNetwork This;
+ // Helper for handling time outs when collecting membership
+ // data. For now, a timeout is treated as a failure.
+ static process::Future<std::list<std::string> > timedout(
+ process::Future<std::list<std::string> > datas)
+ {
+ datas.discard();
+ return process::Failure("Timed out");
+ }
+
// Not copyable, not assignable.
ZooKeeperNetwork(const ZooKeeperNetwork&);
ZooKeeperNetwork& operator = (const ZooKeeperNetwork&);
@@ -411,7 +419,8 @@ inline void ZooKeeperNetwork::watched(
futures.push_back(group.data(membership));
}
- process::collect(futures, process::Timeout::in(Seconds(5)))
+ process::collect(futures)
+ .after(Seconds(5), lambda::bind(&This::timedout, lambda::_1))
.onAny(executor.defer(lambda::bind(&This::collected, this, lambda::_1)));
}