Author: cgutman
Date: Sat Oct 31 16:53:19 2009
New Revision: 43877
URL:
http://svn.reactos.org/svn/reactos?rev=43877&view=rev
Log:
- Fix translation for OSK_EAGAIN/OSK_EWOULDBLOCK
- Don't clear other socket state flags when enabling non-blocking mode
- Remove some incorrect code that plays tricks on oskittcp
Modified:
trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c
trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c
Modified: trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/ip/transport/t…
==============================================================================
--- trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/ip/transport/tcp/tcp.c [iso-8859-1] Sat Oct 31 16:53:19
2009
@@ -559,12 +559,12 @@
switch( OskitError ) {
case 0: Status = STATUS_SUCCESS; break;
- case OSK_EADDRNOTAVAIL:
+ case OSK_EADDRNOTAVAIL: Status = STATUS_INVALID_ADDRESS; break;
case OSK_EAFNOSUPPORT: Status = STATUS_INVALID_CONNECTION; break;
case OSK_ECONNREFUSED:
case OSK_ECONNRESET: Status = STATUS_REMOTE_NOT_LISTENING; break;
+ case OSK_EWOULDBLOCK:
case OSK_EINPROGRESS: Status = STATUS_PENDING; break;
- case OSK_EWOULDBLOCK: Status = STATUS_CANT_WAIT; break;
case OSK_EINVAL: Status = STATUS_INVALID_PARAMETER; break;
case OSK_ENOMEM:
case OSK_ENOBUFS: Status = STATUS_INSUFFICIENT_RESOURCES; break;
Modified: trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/oskittcp/oskit…
==============================================================================
--- trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/oskittcp/oskittcp/interface.c [iso-8859-1] Sat Oct 31
16:53:19 2009
@@ -118,11 +118,7 @@
int error = socreate(domain, &so, type, proto);
if( !error ) {
so->so_connection = context;
- so->so_state = SS_NBIO;
- so->so_error = 0;
- so->so_q = so->so_q0 = NULL;
- so->so_qlen = 0;
- so->so_head = NULL;
+ so->so_state |= SS_NBIO;
*aso = so;
}
return error;
@@ -138,8 +134,6 @@
int error = 0;
int tcp_flags = 0;
- *OutLen = 0;
-
OS_DbgPrint(OSK_MID_TRACE,
("so->so_state %x\n", ((struct socket
*)connection)->so_state));
@@ -147,21 +141,21 @@
if( Flags & OSK_MSG_DONTWAIT ) tcp_flags |= MSG_DONTWAIT;
if( Flags & OSK_MSG_PEEK ) tcp_flags |= MSG_PEEK;
- uio.uio_resid = Len;
- uio.uio_iov = &iov;
- uio.uio_rw = UIO_READ;
- uio.uio_iovcnt = 1;
iov.iov_len = Len;
iov.iov_base = (char *)Data;
+ uio.uio_iov = &iov;
+ uio.uio_iovcnt = 1;
+ uio.uio_offset = 0;
+ uio.uio_resid = Len;
+ uio.uio_segflg = UIO_SYSSPACE;
+ uio.uio_rw = UIO_READ;
+ uio.uio_procp = NULL;
OS_DbgPrint(OSK_MID_TRACE,("Reading %d bytes from TCP:\n", Len));
error = soreceive( connection, NULL, &uio, NULL, NULL /* SCM_RIGHTS */,
&tcp_flags );
-
- if( error == 0 ) {
- *OutLen = Len - uio.uio_resid;
- }
+ *OutLen = Len - uio.uio_resid;
return error;
}
@@ -280,10 +274,7 @@
uio.uio_procp = NULL;
error = sosend( socket, NULL, &uio, NULL, NULL, 0 );
- if (OSK_EWOULDBLOCK == error) {
- ((struct socket *) socket)->so_snd.sb_flags |= SB_WAIT;
- }
- *OutLen = uio.uio_offset;
+ *OutLen = Len - uio.uio_resid;
return error;
}