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/11/16 02:39:14 UTC

[17/30] mesos git commit: Fix race condition in process.cpp.

Fix race condition in process.cpp.

Fix race condition between encoder creation and io::poll in
SocketManager::Send(Message).

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


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

Branch: refs/heads/master
Commit: fcdae2704dbe6cd04c1f705497ae1113cb29e039
Parents: d1d4340
Author: Joris Van Remoortere <jo...@gmail.com>
Authored: Sat Nov 15 16:29:26 2014 -0800
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sat Nov 15 16:29:27 2014 -0800

----------------------------------------------------------------------
 3rdparty/libprocess/src/process.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/fcdae270/3rdparty/libprocess/src/process.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/process.cpp b/3rdparty/libprocess/src/process.cpp
index ac12876..48e5486 100644
--- a/3rdparty/libprocess/src/process.cpp
+++ b/3rdparty/libprocess/src/process.cpp
@@ -1696,15 +1696,15 @@ void SocketManager::send(Message* message)
       // Initialize the outgoing queue.
       outgoing[s];
 
+      // Create a message encoder to handle sending this message.
+      Encoder* encoder = new MessageEncoder(sockets[s], message);
+
       // Read and ignore data from this socket. Note that we don't
       // expect to receive anything other than HTTP '202 Accepted'
       // responses which we just ignore.
       io::poll(s, io::READ)
         .onAny(lambda::bind(&ignore_data, new Socket(sockets[s]), s));
 
-      // Create a message encoder to handle sending this message.
-      Encoder* encoder = new MessageEncoder(sockets[s], message);
-
       // Try and connect to the node using this socket.
       sockaddr_in addr;
       memset(&addr, 0, sizeof(addr));