Author: cgutman
Date: Sat Jul 2 21:47:30 2011
New Revision: 52504
URL:
http://svn.reactos.org/svn/reactos?rev=52504&view=rev
Log:
[OSKITTCP]
- Signal readable when read is closed and writeable when write is closed
- This seems counterintuitive on the surface but signaling the socket in this way ensures
that pending reads and writes are cancelled if either side shuts down send/receive
- Graceful close (recv() returns 0 bytes and FD_CLOSE is signaled when we receive a FIN)
works much better
Modified:
trunk/reactos/lib/drivers/oskittcp/oskittcp/sleep.c
Modified: trunk/reactos/lib/drivers/oskittcp/oskittcp/sleep.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/oskittcp/oskit…
==============================================================================
--- trunk/reactos/lib/drivers/oskittcp/oskittcp/sleep.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/oskittcp/oskittcp/sleep.c [iso-8859-1] Sat Jul 2 21:47:30
2011
@@ -31,13 +31,13 @@
OS_DbgPrint(OSK_MID_TRACE,("Socket accepting q\n"));
flags |= SEL_ACCEPT;
}
- if( so->so_rcv.sb_cc > 0 && !(so->so_state & SS_CANTRCVMORE)
&&
- (so->so_state & SS_ISCONNECTED) ) {
+ if( (so->so_rcv.sb_cc > 0 && (so->so_state & SS_ISCONNECTED))
||
+ (so->so_state & SS_CANTRCVMORE)) {
OS_DbgPrint(OSK_MID_TRACE,("Socket readable\n"));
flags |= SEL_READ;
}
- if( 0 < sbspace(&so->so_snd) && !(so->so_state &
SS_CANTSENDMORE) &&
- (so->so_state & SS_ISCONNECTED) ) {
+ if( (0 < sbspace(&so->so_snd) && (so->so_state &
SS_ISCONNECTED)) ||
+ (so->so_state & SS_CANTSENDMORE)) {
OS_DbgPrint(OSK_MID_TRACE,("Socket writeable\n"));
flags |= SEL_WRITE;
}