AmendHub

Download:

jcs

/

subtext

/

amendments

/

20

tcp: Fix stupid commandTimeoutValue setting in TCPPassiveOpen

This was causing listens to fail after 30 seconds :/
 
Also add UDPMaxMTUSize

jcs made amendment 20 over 2 years ago
--- tcp.c Tue Nov 30 09:22:58 2021 +++ tcp.c Thu Dec 9 13:17:48 2021 @@ -104,10 +104,10 @@ _TCPPassiveOpen(TCPiopb *pb, StreamPtr stream, ip_addr pb->tcpStream = stream; pb->ioResult = 1; - pb->csParam.open.ulpTimeoutValue = 0; - pb->csParam.open.ulpTimeoutAction = 1; + pb->csParam.open.ulpTimeoutAction = 1; /* abort half-open connection */ + pb->csParam.open.ulpTimeoutValue = 5; /* after 5 seconds */ pb->csParam.open.validityFlags = 0xC0; - pb->csParam.open.commandTimeoutValue = 30; + pb->csParam.open.commandTimeoutValue = 0; pb->csParam.open.remoteHost = 0; pb->csParam.open.remotePort = 0; pb->csParam.open.localHost = 0; @@ -123,7 +123,7 @@ _TCPPassiveOpen(TCPiopb *pb, StreamPtr stream, ip_addr pb->csParam.open.userDataPtr = userData; osErr = PBControl((ParmBlkPtr) pb, async); - if (!async && (noErr == osErr)) { + if (!async && (osErr == noErr)) { if (remoteIP) *remoteIP = pb->csParam.open.remoteHost; if (remotePort) @@ -358,6 +358,27 @@ _TCPRelease(TCPiopb *pb, StreamPtr stream, Ptr userDat osErr = PBControl((ParmBlkPtr)pb, async); + return osErr; +} + +OSErr +_UDPMaxMTUSize(UDPiopb *pb, short *mtu) +{ + OSErr osErr; + + memset(pb, 0, sizeof(*pb)); + + pb->csCode = UDPMaxMTUSize; + pb->ioCRefNum = gIPPDriverRefNum; + pb->ioResult = 1; + + pb->csParam.mtu.remoteHost = (ip_addr)0; + + osErr = PBControl((ParmBlkPtr)pb, false); + + if (osErr == noErr) + *mtu = pb->csParam.mtu.mtuSize; + return osErr; } --- tcp.h Fri Nov 13 14:05:09 2020 +++ tcp.h Wed Dec 8 13:27:53 2021 @@ -47,6 +47,8 @@ OSErr _TCPStatus(TCPiopb *pb, StreamPtr stream, struct OSErr _TCPRelease(TCPiopb *pb, StreamPtr stream, Ptr userData, TCPIOCompletionProc ioCompletion, Boolean async); +OSErr _UDPMaxMTUSize(UDPiopb *pb, short *mtu); + OSErr TCPResolveName(char **name, unsigned long *ipAddress); long ip2long(char *ip);