mirror of
https://github.com/reactos/reactos.git
synced 2025-01-04 21:38:43 +00:00
Fixed OskitTCPSend prototype.
sleep: removed blocking. not needed anymore. Made socket non-blocking with respect to oskit. removed unneeded panic in sbflush. removed unneeded stats keeping. This info is better kept by tcpip.sys svn path=/trunk/; revision=10033
This commit is contained in:
parent
494edc04e5
commit
aa565ab062
7 changed files with 44 additions and 44 deletions
|
@ -50,12 +50,12 @@ struct connect_args {
|
|||
#define SEL_ERROR 256
|
||||
#define SEL_FINOUT 512
|
||||
|
||||
typedef void (*OSKITTCP_SOCKET_STATE)
|
||||
typedef int (*OSKITTCP_SOCKET_STATE)
|
||||
( void *ClientData,
|
||||
void *WhichSocket,
|
||||
void *WhichConnection,
|
||||
OSK_UINT SelFlags,
|
||||
OSK_UINT SocketState );
|
||||
OSK_UINT NewState );
|
||||
|
||||
typedef int (*OSKITTCP_SEND_PACKET)
|
||||
( void *ClientData,
|
||||
void *WhichSocket,
|
||||
|
@ -86,6 +86,11 @@ extern int OskitTCPReceive( void *socket,
|
|||
OSK_UINT Len,
|
||||
OSK_UINT *OutLen,
|
||||
OSK_UINT Flags );
|
||||
extern int OskitTCPSend( void *socket,
|
||||
OSK_PCHAR Data,
|
||||
OSK_UINT Len,
|
||||
OSK_UINT *OutLen,
|
||||
OSK_UINT Flags );
|
||||
#undef errno
|
||||
|
||||
#define malloc(x,...) fbsd_malloc(x,__FILE__,__LINE__)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
#include <oskittcp.h>
|
||||
#include <oskitdebug.h>
|
||||
#include <ntddk.h>
|
||||
|
@ -79,13 +80,13 @@ int OskitTCPSocket( void *context,
|
|||
int error = socreate(domain, &so, type, proto);
|
||||
if( !error ) {
|
||||
so->so_connection = context;
|
||||
so->so_state = SS_NBIO;
|
||||
*aso = so;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
int OskitTCPRecv( void *connection,
|
||||
void *Addr,
|
||||
OSK_PCHAR Data,
|
||||
OSK_UINT Len,
|
||||
OSK_UINT *OutLen,
|
||||
|
@ -118,9 +119,6 @@ int OskitTCPRecv( void *connection,
|
|||
OskitDumpBuffer( m.m_data, uio.uio_resid );
|
||||
}
|
||||
|
||||
if( paddr )
|
||||
memcpy( Addr, paddr, min(sizeof(struct sockaddr),paddr->m_len) );
|
||||
|
||||
*OutLen = uio.uio_resid;
|
||||
return error;
|
||||
}
|
||||
|
@ -186,22 +184,6 @@ NTSTATUS OskitTCPConnect( PVOID socket, PVOID connection,
|
|||
goto done;
|
||||
}
|
||||
|
||||
s = splnet();
|
||||
|
||||
while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
|
||||
error = tsleep((caddr_t)&so->so_timeo, PSOCK | PCATCH,
|
||||
"connect", 0);
|
||||
if (error)
|
||||
break;
|
||||
}
|
||||
|
||||
if (error == 0) {
|
||||
error = so->so_error;
|
||||
so->so_error = 0;
|
||||
}
|
||||
|
||||
splx(s);
|
||||
|
||||
bad:
|
||||
so->so_state &= ~SS_ISCONNECTING;
|
||||
|
||||
|
@ -219,12 +201,17 @@ DWORD OskitTCPClose( void *socket ) {
|
|||
soclose( so );
|
||||
}
|
||||
|
||||
DWORD OskitTCPSend( void *socket, OSK_PCHAR Data, OSK_UINT Len, int flags ) {
|
||||
OskitDumpBuffer( Data, Len );
|
||||
int OskitTCPSend( void *socket, OSK_PCHAR Data, OSK_UINT Len,
|
||||
OSK_UINT *OutLen, OSK_UINT flags ) {
|
||||
struct mbuf mb;
|
||||
struct uio uio = { 0 };
|
||||
int error = 0;
|
||||
OskitDumpBuffer( Data, Len );
|
||||
mb.m_data = Data;
|
||||
mb.m_len = Len;
|
||||
return sosend( socket, NULL, NULL, (struct mbuf *)&mb, NULL, 0 );
|
||||
error = sosend( socket, NULL, &uio, (struct mbuf *)&mb, NULL, 0 );
|
||||
*OutLen = uio.uio_resid;
|
||||
return error;
|
||||
}
|
||||
|
||||
void *OskitTCPAccept( void *socket,
|
||||
|
|
|
@ -64,25 +64,29 @@ void wakeup( struct socket *so, struct selinfo *si, void *token ) {
|
|||
KEVENT Event;
|
||||
PLIST_ENTRY Entry;
|
||||
PSLEEPING_THREAD SleepingThread;
|
||||
UINT flags = 0;
|
||||
|
||||
OS_DbgPrint
|
||||
(OSK_MID_TRACE,("XXX Bytes to receive: %d\n", so->so_rcv.sb_cc));
|
||||
|
||||
if( so->so_rcv.sb_cc && si )
|
||||
si->si_flags |= SEL_READ;
|
||||
if( so->so_state & SS_ISCONNECTED ) {
|
||||
OS_DbgPrint(OSK_MID_TRACE,("Socket connected!\n"));
|
||||
flags |= SEL_CONNECT;
|
||||
}
|
||||
if( so->so_rcv.sb_cc && si ) {
|
||||
OS_DbgPrint(OSK_MID_TRACE,("Socket readable\n"));
|
||||
flags |= SEL_READ;
|
||||
}
|
||||
|
||||
OS_DbgPrint(OSK_MID_TRACE,("Wakeup %x (socket %x, si_flags %x, state %x)!\n",
|
||||
token, so, si ? si->si_flags : 0,
|
||||
so->so_state));
|
||||
|
||||
if( OtcpEvent.SocketState ) {
|
||||
OS_DbgPrint(OSK_MID_TRACE,("Calling client's socket state fn\n"));
|
||||
if( OtcpEvent.SocketState )
|
||||
OtcpEvent.SocketState( OtcpEvent.ClientData,
|
||||
so,
|
||||
so->so_connection,
|
||||
si ? si->si_flags : 0,
|
||||
so->so_state );
|
||||
}
|
||||
so ? so->so_connection : 0,
|
||||
flags );
|
||||
|
||||
ExAcquireFastMutex( &SleepingThreadsLock );
|
||||
Entry = SleepingThreadsList.Flink;
|
||||
|
|
|
@ -121,10 +121,11 @@ tcp_reass(tp, ti, m)
|
|||
* Find a segment which begins after this one does.
|
||||
*/
|
||||
for (q = tp->seg_next; q != (struct tcpiphdr *)tp;
|
||||
q = (struct tcpiphdr *)q->ti_next)
|
||||
if (SEQ_GT(q->ti_seq, ti->ti_seq))
|
||||
break;
|
||||
|
||||
q = (struct tcpiphdr *)q->ti_next) {
|
||||
printf("Finding segment: %x\n", q);
|
||||
if (SEQ_GT(q->ti_seq, ti->ti_seq))
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* If there is a preceding segment, it may provide some of
|
||||
* our data already. If so, drop the data from the incoming
|
||||
|
@ -760,7 +761,7 @@ findpcb:
|
|||
*/
|
||||
tp->rcv_adv += min(tp->rcv_wnd, TCP_MAXWIN);
|
||||
tcpstat.tcps_connects++;
|
||||
soisconnected(so);
|
||||
//soisconnected(so);
|
||||
tp->t_timer[TCPT_KEEP] = tcp_keepinit;
|
||||
dropsocket = 0; /* committed to socket */
|
||||
tcpstat.tcps_accepts++;
|
||||
|
@ -853,7 +854,7 @@ findpcb:
|
|||
goto dropwithreset;
|
||||
}
|
||||
tcpstat.tcps_connects++;
|
||||
soisconnected(so);
|
||||
//soisconnected(so);
|
||||
/* Do window scaling on this connection? */
|
||||
if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
|
||||
(TF_RCVD_SCALE|TF_REQ_SCALE)) {
|
||||
|
@ -890,6 +891,7 @@ findpcb:
|
|||
("Socket %x entered ESTABLISHED state\n",
|
||||
so));
|
||||
tp->t_state = TCPS_ESTABLISHED;
|
||||
soisconnected(so);
|
||||
tp->t_timer[TCPT_KEEP] = tcp_keepidle;
|
||||
socwakeup(so);
|
||||
}
|
||||
|
@ -1220,7 +1222,7 @@ trimthenstep6:
|
|||
goto dropwithreset;
|
||||
|
||||
tcpstat.tcps_connects++;
|
||||
soisconnected(so);
|
||||
//soisconnected(so);
|
||||
/* Do window scaling? */
|
||||
if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
|
||||
(TF_RCVD_SCALE|TF_REQ_SCALE)) {
|
||||
|
|
|
@ -452,7 +452,6 @@ tcp_connect(tp, nam)
|
|||
|
||||
in_pcbrehash(inp);
|
||||
|
||||
|
||||
tp->t_template = tcp_template(tp);
|
||||
|
||||
if (tp->t_template == 0) {
|
||||
|
@ -478,7 +477,6 @@ tcp_connect(tp, nam)
|
|||
|
||||
tcp_sendseqinit(tp);
|
||||
|
||||
|
||||
/*
|
||||
* Generate a CC value for this connection and
|
||||
* check whether CC or CCnew should be used.
|
||||
|
|
|
@ -74,6 +74,8 @@ socreate(dom, aso, type, proto)
|
|||
register struct socket *so;
|
||||
register int error;
|
||||
|
||||
printf("socreate(%d,%x,%d,%d)\n", dom, aso, type, proto);
|
||||
|
||||
if (proto)
|
||||
prp = pffindproto(dom, proto, type);
|
||||
else
|
||||
|
@ -352,7 +354,7 @@ sosend(so, addr, uio, top, control, flags)
|
|||
dontroute =
|
||||
(flags & MSG_DONTROUTE) && (so->so_options & SO_DONTROUTE) == 0 &&
|
||||
(so->so_proto->pr_flags & PR_ATOMIC);
|
||||
p->p_stats->p_ru.ru_msgsnd++;
|
||||
/* p->p_stats->p_ru.ru_msgsnd++; */
|
||||
if (control)
|
||||
clen = control->m_len;
|
||||
#define snderr(errno) { error = errno; splx(s); goto release; }
|
||||
|
|
|
@ -742,8 +742,10 @@ sbflush(sb)
|
|||
panic("sbflush");
|
||||
while (sb->sb_mbcnt)
|
||||
sbdrop(sb, (int)sb->sb_cc);
|
||||
#if 0
|
||||
if (sb->sb_cc || sb->sb_mb)
|
||||
panic("sbflush 2");
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue