Skip to content

Commit

Permalink
support to use IPv4
Browse files Browse the repository at this point in the history
  • Loading branch information
liulele committed Jun 27, 2016
1 parent 86a25ed commit de5a949
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions 01_basic-client-server/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,22 @@ static struct context *s_ctx = NULL;

int main(int argc, char **argv)
{
#if _USE_IPV6
struct sockaddr_in6 addr;
#else
struct sockaddr_in addr;
#endif
struct rdma_cm_event *event = NULL;
struct rdma_cm_id *listener = NULL;
struct rdma_event_channel *ec = NULL;
uint16_t port = 0;

memset(&addr, 0, sizeof(addr));
#if _USE_IPV6
addr.sin6_family = AF_INET6;
#else
addr.sin_family = AF_INET;
#endif

TEST_Z(ec = rdma_create_event_channel());
TEST_NZ(rdma_create_id(ec, &listener, NULL, RDMA_PS_TCP));
Expand Down Expand Up @@ -161,15 +169,15 @@ void register_memory(struct connection *conn)
conn->recv_region = malloc(BUFFER_SIZE);

TEST_Z(conn->send_mr = ibv_reg_mr(
s_ctx->pd,
conn->send_region,
BUFFER_SIZE,
s_ctx->pd,
conn->send_region,
BUFFER_SIZE,
IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE));

TEST_Z(conn->recv_mr = ibv_reg_mr(
s_ctx->pd,
conn->recv_region,
BUFFER_SIZE,
s_ctx->pd,
conn->recv_region,
BUFFER_SIZE,
IBV_ACCESS_LOCAL_WRITE | IBV_ACCESS_REMOTE_WRITE));
}

Expand Down

0 comments on commit de5a949

Please sign in to comment.