summaryrefslogtreecommitdiffstats
path: root/sys/netinet/accf_http.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/accf_http.c')
-rw-r--r--sys/netinet/accf_http.c31
1 files changed, 25 insertions, 6 deletions
diff --git a/sys/netinet/accf_http.c b/sys/netinet/accf_http.c
index 4a3e17e..4849f6b 100644
--- a/sys/netinet/accf_http.c
+++ b/sys/netinet/accf_http.c
@@ -31,7 +31,9 @@
#include <sys/param.h>
#include <sys/kernel.h>
+#include <sys/lock.h>
#include <sys/mbuf.h>
+#include <sys/mutex.h>
#include <sys/signalvar.h>
#include <sys/sysctl.h>
#include <sys/socketvar.h>
@@ -160,11 +162,13 @@ static void
sohashttpget(struct socket *so, void *arg, int waitflag)
{
+ SOCK_LOCK(so);
if ((so->so_state & SS_CANTRCVMORE) == 0 && !sbfull(&so->so_rcv)) {
struct mbuf *m;
char *cmp;
int cmplen, cc;
+ SOCK_UNLOCK(so);
m = so->so_rcv.sb_mb;
cc = so->so_rcv.sb_cc - 1;
if (cc < 1)
@@ -197,13 +201,16 @@ sohashttpget(struct socket *so, void *arg, int waitflag)
return;
}
DPRINT("mbufstrcmp bad");
- }
+ } else
+ SOCK_UNLOCK(so);
fallout:
DPRINT("fallout");
+ SOCK_LOCK(so);
so->so_upcall = NULL;
so->so_rcv.sb_flags &= ~SB_UPCALL;
- soisconnected_locked(so);
+ soisconnected(so);
+ SOCK_UNLOCK(so);
return;
}
@@ -213,8 +220,12 @@ soparsehttpvers(struct socket *so, void *arg, int waitflag)
struct mbuf *m, *n;
int i, cc, spaces, inspaces;
- if ((so->so_state & SS_CANTRCVMORE) != 0 || sbfull(&so->so_rcv))
+ SOCK_LOCK(so);
+ if ((so->so_state & SS_CANTRCVMORE) != 0 || sbfull(&so->so_rcv)) {
+ SOCK_UNLOCK(so);
goto fallout;
+ }
+ SOCK_UNLOCK(so);
m = so->so_rcv.sb_mb;
cc = so->so_rcv.sb_cc;
@@ -283,9 +294,11 @@ readmore:
fallout:
DPRINT("fallout");
+ SOCK_LOCK(so);
so->so_upcall = NULL;
so->so_rcv.sb_flags &= ~SB_UPCALL;
- soisconnected_locked(so);
+ soisconnected(so);
+ SOCK_UNLOCK(so);
return;
}
@@ -300,8 +313,12 @@ soishttpconnected(struct socket *so, void *arg, int waitflag)
int ccleft, copied;
DPRINT("start");
- if ((so->so_state & SS_CANTRCVMORE) != 0 || sbfull(&so->so_rcv))
+ SOCK_LOCK(so);
+ if ((so->so_state & SS_CANTRCVMORE) != 0 || sbfull(&so->so_rcv)) {
+ SOCK_UNLOCK(so);
goto gotit;
+ }
+ SOCK_UNLOCK(so);
/*
* Walk the socketbuffer and copy the last NCHRS (3) into a, b, and c
@@ -353,8 +370,10 @@ readmore:
return;
gotit:
+ SOCK_LOCK(so);
so->so_upcall = NULL;
so->so_rcv.sb_flags &= ~SB_UPCALL;
- soisconnected_locked(so);
+ soisconnected(so);
+ SOCK_UNLOCK(so);
return;
}
OpenPOWER on IntegriCloud