]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
Refresh of dsocket
authorSean Hefty <sean.hefty@intel.com>
Sat, 8 Dec 2012 01:01:27 +0000 (17:01 -0800)
committerSean Hefty <sean.hefty@intel.com>
Sat, 8 Dec 2012 01:01:27 +0000 (17:01 -0800)
src/rsocket.c

index 9996d3331f478a6eb26f490aa6e13a391726a2e8..f35abebbb1d7da4936ca89eed1ff7933f1b60c3c 100644 (file)
@@ -554,8 +554,10 @@ static struct rsocket *rs_alloc(struct rsocket *inherited_rs, int type)
 
        rs->type = type;
        rs->index = -1;
-       rs->udp_sock = -1;
-       rs->epfd = -1;
+       if (type == SOCK_DGRAM) {
+               rs->udp_sock = -1;
+               rs->epfd = -1;
+       }
 
        if (inherited_rs) {
                rs->sbuf_size = inherited_rs->sbuf_size;
@@ -563,16 +565,20 @@ static struct rsocket *rs_alloc(struct rsocket *inherited_rs, int type)
                rs->sq_inline = inherited_rs->sq_inline;
                rs->sq_size = inherited_rs->sq_size;
                rs->rq_size = inherited_rs->rq_size;
-               rs->ctrl_avail = inherited_rs->ctrl_avail;
-               rs->target_iomap_size = inherited_rs->target_iomap_size;
+               if (type == SOCK_STREAM) {
+                       rs->ctrl_avail = inherited_rs->ctrl_avail;
+                       rs->target_iomap_size = inherited_rs->target_iomap_size;
+               }
        } else {
                rs->sbuf_size = def_wmem;
                rs->rbuf_size = def_mem;
                rs->sq_inline = def_inline;
                rs->sq_size = def_sqsize;
                rs->rq_size = def_rqsize;
-               rs->ctrl_avail = RS_QP_CTRL_SIZE;
-               rs->target_iomap_size = def_iomap_size;
+               if (type == SOCK_STREAM) {
+                       rs->ctrl_avail = RS_QP_CTRL_SIZE;
+                       rs->target_iomap_size = def_iomap_size;
+               }
        }
        fastlock_init(&rs->slock);
        fastlock_init(&rs->rlock);