WIP daemon
authorRalph Boehme <slow@samba.org>
Fri, 30 Sep 2016 06:19:06 +0000 (23:19 -0700)
committerStefan Metzmacher <metze@samba.org>
Fri, 1 Jun 2018 12:35:10 +0000 (14:35 +0200)
libcli/smb/smb_direct_daemon.c

index 0ea3e5944fd9b902b1b1502b91aa36ec3476861e..be9fa4a3f08f8f36861be741a44c6fd46ba50187 100644 (file)
@@ -884,22 +884,27 @@ static void rdma_cm_handler(struct tevent_context *ev,
                conn_param.initiator_depth = 1;
 //             conn_param.retry_count = 10;
 
-               errno = 0;
-
-               result = rdma_accept(cm_ev->id, NULL);
-               if (result != 0) {
-                       DBG_ERR("rdma_accept failed [%s] result [%d]\n", strerror(errno), result);
-                       goto fail;
-               }
-
                sconn = smb_direct_connection_listener(daemon_state,
                                                       cm_ev->id);
                if (sconn == NULL) {
                        DBG_ERR("smb_direct_connection_create failed\n");
-                       return;
+                       goto fail;
+               }
+
+               status = smb_direct_connection_complete_alloc(sconn);
+               if (!NT_STATUS_IS_OK(status)) {
+                       DBG_ERR("smb_direct_connection_complete_alloc failed\n");
+                       goto fail;
                }
 
                cm_ev->id->context = sconn;
+
+               result = rdma_accept(cm_ev->id, NULL);
+               if (result != 0) {
+                       DBG_ERR("rdma_accept failed [%s] result [%d]\n", strerror(errno), result);
+                       goto fail;
+               }
+
                break;
        }
 
@@ -908,11 +913,6 @@ static void rdma_cm_handler(struct tevent_context *ev,
 
                sconn = talloc_get_type_abort(cm_ev->id->context,
                                              struct smb_direct_connection);
-               status = smb_direct_connection_complete_alloc(sconn);
-               if (!NT_STATUS_IS_OK(status)) {
-                       DBG_ERR("smb_direct_connection_complete_alloc failed\n");
-                       return;
-               }
                /*
                 * TODO: get things going...
                 */