Author: davide
Date: Sat Feb 14 20:00:57 2015
New Revision: 278780
URL: https://svnweb.freebsd.org/changeset/base/278780

Log:
  Don't access sockbuf fields directly, use accessor functions instead.
  It is safe to move the call to socantsendmore_locked() after
  sbdrop_locked() as long as we hold the sockbuf lock across the two
  calls.
  
  CR:   D1805
  Reviewed by:  adrian, kmacy, julian, rwatson

Modified:
  head/sys/kern/uipc_socket.c

Modified: head/sys/kern/uipc_socket.c
==============================================================================
--- head/sys/kern/uipc_socket.c Sat Feb 14 19:41:26 2015        (r278779)
+++ head/sys/kern/uipc_socket.c Sat Feb 14 20:00:57 2015        (r278780)
@@ -3439,11 +3439,9 @@ soisdisconnecting(struct socket *so)
        SOCKBUF_LOCK(&so->so_rcv);
        so->so_state &= ~SS_ISCONNECTING;
        so->so_state |= SS_ISDISCONNECTING;
-       so->so_rcv.sb_state |= SBS_CANTRCVMORE;
-       sorwakeup_locked(so);
+       socantrcvmore_locked(so);
        SOCKBUF_LOCK(&so->so_snd);
-       so->so_snd.sb_state |= SBS_CANTSENDMORE;
-       sowwakeup_locked(so);
+       socantsendmore_locked(so);
        wakeup(&so->so_timeo);
 }
 
@@ -3458,12 +3456,10 @@ soisdisconnected(struct socket *so)
        SOCKBUF_LOCK(&so->so_rcv);
        so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
        so->so_state |= SS_ISDISCONNECTED;
-       so->so_rcv.sb_state |= SBS_CANTRCVMORE;
-       sorwakeup_locked(so);
+       socantrcvmore_locked(so);
        SOCKBUF_LOCK(&so->so_snd);
-       so->so_snd.sb_state |= SBS_CANTSENDMORE;
        sbdrop_locked(&so->so_snd, sbused(&so->so_snd));
-       sowwakeup_locked(so);
+       socantsendmore_locked(so);
        wakeup(&so->so_timeo);
 }
 
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to