replace problematic stack variable in OskitTCPSend() with properly allocated mbuf, and get rid of a redundant memcpy() in OskitTCPReceiveDatagram().

svn path=/trunk/; revision=10972
This commit is contained in:
Royce Mitchell III 2004-09-22 13:35:11 +00:00
parent 3c9fc0f8ce
commit 540291d651

View file

@ -249,20 +249,13 @@ int OskitTCPClose( void *socket ) {
int OskitTCPSend( void *socket, OSK_PCHAR Data, OSK_UINT Len,
OSK_UINT *OutLen, OSK_UINT flags ) {
struct mbuf mb;
/*struct uio uio = { 0 };*/
struct mbuf* m = m_devget( Data, Len, 0, NULL, NULL );
int error = 0;
if ( !m )
return ENOBUFS;
OskitDumpBuffer( Data, Len );
/*uio.uio_resid = Len;*/
mb.m_data = Data;
mb.m_len = Len;
mb.m_flags = M_EOR;
mb.m_pkthdr.len = Len;
mb.m_next = 0;
mb.m_nextpkt = 0;
error = sosend( socket, NULL, NULL /*&uio*/, (struct mbuf *)&mb, NULL, 0 );
/*printf("uio.uio_resid = %d\n", uio.uio_resid);*/
*OutLen = Len /*uio.uio_resid*/;
error = sosend( socket, NULL, NULL, m, NULL, 0 );
*OutLen = Len;
return error;
}
@ -292,7 +285,7 @@ void OskitTCPReceiveDatagram( OSK_PCHAR Data, OSK_UINT Len,
if( !Ip ) return; /* drop the segment */
memcpy( Ip->m_data, Data, Len );
//memcpy( Ip->m_data, Data, Len );
Ip->m_pkthdr.len = IpHeaderLen;
/* Do the transformations on the header that tcp_input expects */