lkml.org 
[lkml]   [1999]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: accept() doesn't block as it should in 2.3.x kernels
dcd@tc.fluke.com said:
>
> The following demo code should block on the call to accept
> but it doesn't in 2.3.x, (where x is 24,27,28,30,31, and 32pre2)
>
> 2.2.5, 2.2.13, and 2.2.14pre9 block as expected in accept()
>
> I'm getting
> ENOTCONN "Transport endpoint is not connected"

Looks like the changes to 2.3.15 did not take the accept() case into
account.
-- Pete

--- linux/net/core/datagram.c.orig Sun Dec 12 13:30:40 1999
+++ linux/net/core/datagram.c Sun Dec 12 13:31:50 1999
@@ -20,6 +20,7 @@
* Alan Cox : Datagram iovec handling
* Darryl Miles : Fixed non-blocking SOCK_STREAM.
* Alan Cox : POSIXisms
+ * Pete Wyckoff : Unconnected accept() fix.
*
*/

@@ -82,7 +83,7 @@

/* Sequenced packets can come disconnected. If so we report the problem */
error = -ENOTCONN;
- if(connection_based(sk) && sk->state!=TCP_ESTABLISHED)
+ if(connection_based(sk) && !(sk->state==TCP_ESTABLISHED || sk->state==TCP_LISTEN))
goto out;

/* handle signals */
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [W:0.063 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site