Close TCP connections for RDMA clients
This commit is contained in:
@@ -541,7 +541,7 @@ bool osd_messenger_t::connect_rdma(uint64_t client_id, std::string rdma_address,
|
||||
{
|
||||
// Remember connection, but switch to RDMA only after sending the configuration response
|
||||
cl->rdma_conn = rdma_conn;
|
||||
cl->peer_state = PEER_RDMA_CONNECTING;
|
||||
cl->peer_state = PEER_RDMA_CONNECTING_IN;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -700,7 +700,7 @@ void osd_messenger_t::handle_rdma_events(msgr_rdma_context_t *rdma_context)
|
||||
auto rc = cl->rdma_conn;
|
||||
if (wc[i].status != IBV_WC_SUCCESS)
|
||||
{
|
||||
fprintf(stderr, "RDMA work request failed for client %ju", client_id);
|
||||
fprintf(stderr, "RDMA work request (%s) failed for client %ju", is_send ? "send" : "recv", client_id);
|
||||
if (cl->osd_num)
|
||||
{
|
||||
fprintf(stderr, " (OSD %ju)", cl->osd_num);
|
||||
@@ -711,6 +711,23 @@ void osd_messenger_t::handle_rdma_events(msgr_rdma_context_t *rdma_context)
|
||||
}
|
||||
if (!is_send)
|
||||
{
|
||||
if (cl->peer_state == PEER_RDMA_CONNECTING_OUT)
|
||||
{
|
||||
// First message received over RDMA - TCP socket can be closed now
|
||||
if (log_level > 0)
|
||||
{
|
||||
fprintf(stderr, "Successfully connected with client %ju using RDMA\n", cl->client_id);
|
||||
}
|
||||
cl->peer_state = PEER_RDMA;
|
||||
if (cl->peer_fd >= 0 && cl->rdma_close_tcp)
|
||||
{
|
||||
// TCP socket is not needed anymore
|
||||
tfd->set_fd_handler(cl->peer_fd, false, NULL);
|
||||
clients_by_fd.erase(cl->peer_fd);
|
||||
close(cl->peer_fd);
|
||||
cl->peer_fd = -1;
|
||||
}
|
||||
}
|
||||
rc->cur_recv--;
|
||||
if (!handle_read_buffer(cl, rc->recv_buffers[rc->next_recv_buf], wc[i].byte_len))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user