]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
AsyncConnection: create writable event for in progress connection 9086/head
authorHaomai Wang <haomai@xsky.com>
Thu, 12 May 2016 04:01:35 +0000 (12:01 +0800)
committerHaomai Wang <haomai@xsky.com>
Thu, 12 May 2016 04:07:37 +0000 (12:07 +0800)
Previously we use a tricky with ceph msgr protocol, if initiator side got
in progress connection state, it will wait until read event. Because if
tcp session built successfully server side will send the banner firstly
and initiator side will get read event. Otherwise, if connection failed,
read event also be called.

But actually man(2)[http://man7.org/linux/man-pages/man2/connect.2.html]
specify if we want to get notification whether connection built, we need
to listen writable event. It means when connection built, send buffer
is ready to be written.

This patch follow the strict nonblock connect process. Not fully sure fix
http://tracker.ceph.com/issues/15849

Signed-off-by: Haomai Wang <haomai@xsky.com>
src/msg/async/AsyncConnection.cc

index 5e066372d2ca15dad577f7103f7a18f644d3934c..4db18baf776aab094907320fef93c9308c327dd4 100644 (file)
@@ -1046,9 +1046,12 @@ ssize_t AsyncConnection::_process_connection()
           ldout(async_msgr->cct, 1) << __func__ << " reconnect failed " << dendl;
           goto fail;
         } else if (r > 0) {
+          ldout(async_msgr->cct, 10) << __func__ << " nonblock connect inprogress" << dendl;
+          center->create_file_event(sd, EVENT_WRITABLE, read_handler);
           break;
         }
 
+        center->delete_file_event(sd, EVENT_WRITABLE);
         state = STATE_CONNECTING_WAIT_BANNER;
         break;
       }