This is an automated email from the ASF dual-hosted git repository.

bmahler pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mesos.git


The following commit(s) were added to refs/heads/master by this push:
     new fb0e7db  Replaced a pointer to managed MockMasterAPISubscriberProcess 
with a pid.
fb0e7db is described below

commit fb0e7db8b63e81fb8fb2629faaeb5aa3848b78d8
Author: Andrei Sekretenko <[email protected]>
AuthorDate: Wed Jun 12 15:34:24 2019 -0400

    Replaced a pointer to managed MockMasterAPISubscriberProcess with a pid.
    
    Review: https://reviews.apache.org/r/70843/
---
 src/tests/master/mock_master_api_subscriber.cpp | 17 ++++++++---------
 src/tests/master/mock_master_api_subscriber.hpp |  4 ++--
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/src/tests/master/mock_master_api_subscriber.cpp 
b/src/tests/master/mock_master_api_subscriber.cpp
index a1cd538..a0808e8 100644
--- a/src/tests/master/mock_master_api_subscriber.cpp
+++ b/src/tests/master/mock_master_api_subscriber.cpp
@@ -47,7 +47,7 @@ public:
     : subscriber(subscriber_) {};
 
   Future<Nothing> subscribe(
-    const process::PID<Master>& pid, ContentType contentType)
+    const process::PID<Master>& masterPid, ContentType contentType)
   {
     Call call;
     call.set_type(Call::SUBSCRIBE);
@@ -56,7 +56,7 @@ public:
     headers["Accept"] = stringify(contentType);
 
     return process::http::streaming::post(
-        pid,
+        masterPid,
         "api/v1",
         headers,
         serialize(contentType, call),
@@ -170,26 +170,25 @@ MockMasterAPISubscriber::MockMasterAPISubscriber()
 
   subscribeCalled = false;
 
-  process = new MockMasterAPISubscriberProcess(this);
-  spawn(process, true);
+  pid = spawn(new MockMasterAPISubscriberProcess(this), true);
 }
 
 
 MockMasterAPISubscriber::~MockMasterAPISubscriber()
 {
-  process::terminate(process);
+  process::terminate(pid);
 
   // The process holds a pointer to this object, and so
   // we must ensure it won't access the pointer before
   // we exit the destructor.
   //
   // TODO(asekretenko): Figure out a way to avoid blocking.
-  process::wait(process);
+  process::wait(pid);
 }
 
 
 Future<Nothing> MockMasterAPISubscriber::subscribe(
-    const process::PID<Master>& pid,
+    const process::PID<Master>& masterPid,
     ContentType contentType)
 {
   if (subscribeCalled) {
@@ -200,9 +199,9 @@ Future<Nothing> MockMasterAPISubscriber::subscribe(
   subscribeCalled = true;
 
   return dispatch(
-      process,
-      &MockMasterAPISubscriberProcess::subscribe,
       pid,
+      &MockMasterAPISubscriberProcess::subscribe,
+      masterPid,
       contentType);
 }
 
diff --git a/src/tests/master/mock_master_api_subscriber.hpp 
b/src/tests/master/mock_master_api_subscriber.hpp
index dde176a..e50324f 100644
--- a/src/tests/master/mock_master_api_subscriber.hpp
+++ b/src/tests/master/mock_master_api_subscriber.hpp
@@ -80,7 +80,7 @@ public:
   // NOTE: All expectations on the mock methods should be set before calling
   // this method.
   process::Future<Nothing> subscribe(
-    const process::PID<mesos::internal::master::Master>&,
+    const process::PID<mesos::internal::master::Master>& masterPid,
     ContentType contentType = ContentType::PROTOBUF);
 
 private:
@@ -88,7 +88,7 @@ private:
   void handleEvent(const ::mesos::v1::master::Event& event);
 
   bool subscribeCalled;
-  MockMasterAPISubscriberProcess* process;
+  process::PID<MockMasterAPISubscriberProcess> pid;
 };
 
 

Reply via email to