summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Dritschler <timo.dritschler@kit.edu>2015-02-16 17:35:43 +0100
committerTimo Dritschler <timo.dritschler@kit.edu>2015-03-09 17:35:41 +0100
commit13db03534b26304cab537953f99c2db8755d753b (patch)
tree7fc842615ad4c458da6cb92b695ea173dafea622
parent5a42e05449b6c21f3041b9638cdfb853260c7e2b (diff)
downloadkiro-13db03534b26304cab537953f99c2db8755d753b.tar.gz
kiro-13db03534b26304cab537953f99c2db8755d753b.tar.bz2
kiro-13db03534b26304cab537953f99c2db8755d753b.tar.xz
kiro-13db03534b26304cab537953f99c2db8755d753b.zip
Fixed KIRO Client allocating new memory on each ACK_RDMA message
-rw-r--r--src/kiro-client.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/kiro-client.c b/src/kiro-client.c
index b9c33c5..01f4fb0 100644
--- a/src/kiro-client.c
+++ b/src/kiro-client.c
@@ -205,18 +205,23 @@ process_rdma_event (GIOChannel *source, GIOCondition condition, gpointer data)
if (type == KIRO_ACK_RDMA) {
g_debug ("Got RDMI Access information from Server");
- ctx->peer_mr = (((struct kiro_ctrl_msg *) (ctx->cf_mr_recv->mem))->peer_mri);
- g_debug ("Expected Memory Size is: %zu", ctx->peer_mr.length);
- ctx->rdma_mr = kiro_create_rdma_memory (priv->conn->pd, ctx->peer_mr.length, IBV_ACCESS_LOCAL_WRITE);
-
- if (!ctx->rdma_mr) {
- //FIXME: Connection teardown in an event handler routine? Not a good
- //idea...
- g_critical ("Failed to allocate memory for receive buffer (Out of memory?)");
- rdma_disconnect (priv->conn);
- kiro_destroy_connection_context (&ctx);
- rdma_destroy_ep (priv->conn);
- return TRUE;
+ if (ctx->rdma_mr) {
+ g_debug ("But memory is already allocated. Ignoring");
+ }
+ else {
+ ctx->peer_mr = (((struct kiro_ctrl_msg *) (ctx->cf_mr_recv->mem))->peer_mri);
+ g_debug ("Expected Memory Size is: %zu", ctx->peer_mr.length);
+ ctx->rdma_mr = kiro_create_rdma_memory (priv->conn->pd, ctx->peer_mr.length, IBV_ACCESS_LOCAL_WRITE);
+
+ if (!ctx->rdma_mr) {
+ //FIXME: Connection teardown in an event handler routine? Not a good
+ //idea...
+ g_critical ("Failed to allocate memory for receive buffer (Out of memory?)");
+ rdma_disconnect (priv->conn);
+ kiro_destroy_connection_context (&ctx);
+ rdma_destroy_ep (priv->conn);
+ return TRUE;
+ }
}
}
if (type == KIRO_PONG) {