You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by vi...@apache.org on 2013/08/07 04:58:03 UTC
[2/5] git commit: Added the ability to spoof the sender when posting
a message.
Added the ability to spoof the sender when posting a message.
Review: https://reviews.apache.org/r/13258
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/108eb365
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/108eb365
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/108eb365
Branch: refs/heads/master
Commit: 108eb3655727fe7f8f08cc196f54fcfe4c5c12a9
Parents: acc2416
Author: Vinod Kone <vi...@twitter.com>
Authored: Sat Aug 3 12:43:19 2013 -0700
Committer: Vinod Kone <vi...@twitter.com>
Committed: Tue Aug 6 19:57:26 2013 -0700
----------------------------------------------------------------------
3rdparty/libprocess/include/process/process.hpp | 7 +++++++
3rdparty/libprocess/include/process/protobuf.hpp | 10 ++++++++++
3rdparty/libprocess/src/process.cpp | 17 +++++++++++++++++
3 files changed, 34 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/108eb365/3rdparty/libprocess/include/process/process.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/process.hpp b/3rdparty/libprocess/include/process/process.hpp
index df7e143..b502324 100644
--- a/3rdparty/libprocess/include/process/process.hpp
+++ b/3rdparty/libprocess/include/process/process.hpp
@@ -329,6 +329,13 @@ void post(const UPID& to,
size_t length = 0);
+void post(const UPID& from,
+ const UPID& to,
+ const std::string& name,
+ const char* data = NULL,
+ size_t length = 0);
+
+
// Inline implementations of above.
inline void terminate(const ProcessBase& process, bool inject)
{
http://git-wip-us.apache.org/repos/asf/mesos/blob/108eb365/3rdparty/libprocess/include/process/protobuf.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/protobuf.hpp b/3rdparty/libprocess/include/process/protobuf.hpp
index 580c87a..e0338d9 100644
--- a/3rdparty/libprocess/include/process/protobuf.hpp
+++ b/3rdparty/libprocess/include/process/protobuf.hpp
@@ -27,6 +27,16 @@ inline void post(const process::UPID& to,
post(to, message.GetTypeName(), data.data(), data.size());
}
+
+inline void post(const process::UPID& from,
+ const process::UPID& to,
+ const google::protobuf::Message& message)
+{
+ std::string data;
+ message.SerializeToString(&data);
+ post(from, to, message.GetTypeName(), data.data(), data.size());
+}
+
} // namespace process {
http://git-wip-us.apache.org/repos/asf/mesos/blob/108eb365/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index 0b4f90f..7cade9a 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -3381,6 +3381,23 @@ void post(const UPID& to, const string& name, const char* data, size_t length)
}
+void post(const UPID& from,
+ const UPID& to,
+ const string& name,
+ const char* data,
+ size_t length)
+{
+ process::initialize();
+
+ if (!to) {
+ return;
+ }
+
+ // Encode and transport outgoing message.
+ transport(encode(from, to, name, string(data, length)));
+}
+
+
namespace io {
namespace internal {