Fixed flaky EOFBeforeRecv test.

This patch is a small correction of commit d4185d4a11.
Before this patch, if EOF event for a ssl socket is received before
a client called `recv`, then this EOF event is lost. This leads to
hanging `recv` on the ssl socket after calling `shutdown`.

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


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

Branch: refs/heads/master
Commit: 52a55debebdba2f40361dafc5c10cf9d1b1a584d
Parents: ff69158
Author: Andrei Budnik <abud...@mesosphere.com>
Authored: Wed Jan 17 18:00:53 2018 +0100
Committer: Alexander Rukletsov <al...@apache.org>
Committed: Wed Jan 17 18:00:53 2018 +0100

----------------------------------------------------------------------
 3rdparty/libprocess/src/libevent_ssl_socket.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/52a55deb/3rdparty/libprocess/src/libevent_ssl_socket.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/libevent_ssl_socket.cpp 
b/3rdparty/libprocess/src/libevent_ssl_socket.cpp
index 1c95eba..d5ce25f 100644
--- a/3rdparty/libprocess/src/libevent_ssl_socket.cpp
+++ b/3rdparty/libprocess/src/libevent_ssl_socket.cpp
@@ -385,9 +385,9 @@ void LibeventSSLSocketImpl::event_callback(short events)
   // recv errors, but perhaps we should?
   if (events & BEV_EVENT_EOF ||
      (events & BEV_EVENT_ERROR && EVUTIL_SOCKET_ERROR() == 0)) {
-    if (current_recv_request.get() != nullptr) {
-      received_eof = true;
+    received_eof = true;
 
+    if (current_recv_request.get() != nullptr) {
       // Drain any remaining data from the bufferevent or complete the
       // promise with 0 to signify EOF. Because we set `received_eof`,
       // subsequent calls to `recv` will return 0 if there is no data

Reply via email to