]> git.openfabrics.org - ~shefty/librdmacm.git/commitdiff
rsocket: Handle SHUT_RD/WR shutdown flags
authorSean Hefty <sean.hefty@intel.com>
Mon, 4 Jun 2012 20:14:42 +0000 (13:14 -0700)
committerSean Hefty <sean.hefty@intel.com>
Wed, 6 Jun 2012 18:23:24 +0000 (11:23 -0700)
Sridhar Samudrala <sri@us.ibm.com> reported an error (EOPNOTSUPP)
after calling select().

The issue is that rshutdown(SHUT_WR) was called before select().
As part of shutdown, rsockets switches the underlying fd from
nonblocking to blocking to ensure that previously sent data has
completed.  shutdown(SHUT_WR) indicates that the socket should be
kept open for receiving data.

Delay handling the actual shutdown unless SHUT_RDWR is specified,
or the socket is closed.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
src/rsocket.c

index c11179701833b0b18b2f5b42b9614948e3c6b2f9..8f20b4abdcaf0a1421ec85e5e5a943331d317061 100644 (file)
@@ -1592,6 +1592,9 @@ int rshutdown(int socket, int how)
        struct rsocket *rs;
        int ret = 0;
 
+       if (how != SHUT_RDWR)
+               return 0;
+
        rs = idm_at(&idm, socket);
        if (rs->fd_flags & O_NONBLOCK)
                rs_set_nonblocking(rs, 0);