Lock socket buffers when processing setting socket options SO_SNDLOWAT

or SO_RCVLOWAT for read-modify-write.
This commit is contained in:
Robert Watson 2004-06-24 04:28:30 +00:00
parent 63a9224f4c
commit c6b93bf29a

View File

@ -1495,14 +1495,18 @@ sosetopt(so, sopt)
* the high-water.
*/
case SO_SNDLOWAT:
SOCKBUF_LOCK(&so->so_snd);
so->so_snd.sb_lowat =
(optval > so->so_snd.sb_hiwat) ?
so->so_snd.sb_hiwat : optval;
SOCKBUF_UNLOCK(&so->so_snd);
break;
case SO_RCVLOWAT:
SOCKBUF_LOCK(&so->so_rcv);
so->so_rcv.sb_lowat =
(optval > so->so_rcv.sb_hiwat) ?
so->so_rcv.sb_hiwat : optval;
SOCKBUF_UNLOCK(&so->so_rcv);
break;
}
break;