patch-2.3.15 linux/net/khttpd/waitheaders.c

Next file: linux/net/netlink/af_netlink.c
Previous file: linux/net/khttpd/userspace.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.14/linux/net/khttpd/waitheaders.c linux/net/khttpd/waitheaders.c
@@ -34,6 +34,7 @@
 	The number of requests that changed status
 */
 
+#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/skbuff.h>
 #include <linux/smp_lock.h>
@@ -67,8 +68,8 @@
 		
 		/* If the connection is lost, remove from queue */
 		
-		lock_sock(CurrentRequest->sock->sk);
-		if (CurrentRequest->sock->sk->state!=TCP_ESTABLISHED)
+		if (CurrentRequest->sock->sk->state != TCP_ESTABLISHED
+		    && CurrentRequest->sock->sk->state != TCP_CLOSE_WAIT)
 		{
 			struct http_request *Next;
 			
@@ -76,7 +77,6 @@
 			
 			*Prev = CurrentRequest->Next;
 			CurrentRequest->Next = NULL;
-			release_sock(CurrentRequest->sock->sk);
 			
 		
 			CleanUpRequest(CurrentRequest);
@@ -90,12 +90,11 @@
 		
 		sk = CurrentRequest->sock->sk;
 		
-		if (atomic_read(&(sk->rmem_alloc))>0) /* Do we have data ? */
+		if (!skb_queue_empty(&(sk->receive_queue))) /* Do we have data ? */
 		{
 			struct http_request *Next;
 			
 			
-			release_sock(CurrentRequest->sock->sk);
 			
 			/* Decode header */
 			
@@ -129,8 +128,6 @@
 			continue;
 		
 		}	
-		else
-			release_sock(CurrentRequest->sock->sk);
 
 		
 		Prev = &(CurrentRequest->Next);
@@ -200,6 +197,12 @@
 	
 	len = sock_recvmsg(Request->sock,&msg,4095,MSG_PEEK);
 	set_fs(oldfs);
+
+	if (len<0) {
+		/* WONDERFUL. NO COMMENTS. --ANK */
+		Request->IsForUserspace = 1;
+		return 0;
+	}
 
 	if (len>=4094) /* BIG header, we cannot decode it so leave it to userspace */	
 	{

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)