Succeed calls to set the SO_LINGER socket option. We don't
actually implement SO_LINGER semantics because we never place
an rsocket into a timewait state. Unlike socket behavior,
we do wait for all pending data to be transferred by the hardware.
This is done so that the disconnect message can be sent over
the rsocket connection.
Signed-off-by: Sean Hefty <sean.hefty@intel.com>
rs->sbuf_size = (*(uint32_t *) optval) << 1;
ret = 0;
break;
+ case SO_LINGER:
+ /* Invert value so default so_opt = 0 is on */
+ opt_on = !((struct linger *) optval)->l_onoff;
+ ret = 0;
+ break;
default:
break;
}
*((int *) optval) = rs->sbuf_size;
*optlen = sizeof(int);
break;
+ case SO_LINGER:
+ /* Value is inverted so default so_opt = 0 is on */
+ ((struct linger *) optval)->l_onoff =
+ !(rs->so_opts & (1 << optname));
+ ((struct linger *) optval)->l_linger = 0;
+ *optlen = sizeof(struct linger);
+ break;
case SO_ERROR:
*((int *) optval) = rs->err;
*optlen = sizeof(int);