Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Added Mark Roseman's fix for the socket writes over a slow network. Copy the data that you pass to the socket write routine to keep it from getting overwritten by the next send packet. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | core-8-0-5-branch |
Files: | files | file ages | folders |
SHA1: |
213d1f24254a4aa69601e7c7b31ea495 |
User & Date: | jingham 1999-03-22 05:42:54.000 |
Context
1999-03-22
| ||
17:39 | Adding the file tclMacSerial.c for Jim Ingham. check-in: d6575ceaed user: rjohnson tags: core-8-0-5-branch | |
05:42 | Added Mark Roseman's fix for the socket writes over a slow network. Copy the data that you pass to ... check-in: 213d1f2425 user: jingham tags: core-8-0-5-branch | |
05:42 | Added some const's to fit with MoreFiles 1.4.9 check-in: dea0ac1965 user: jingham tags: core-8-0-5-branch | |
Changes
Changes to mac/tclMacSock.c.
1 2 3 4 5 6 7 8 9 10 | /* * tclMacSock.c * * Channel drivers for Macintosh sockets. * * Copyright (c) 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | /* * tclMacSock.c * * Channel drivers for Macintosh sockets. * * Copyright (c) 1996-1997 Sun Microsystems, Inc. * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * RCS: @(#) $Id: tclMacSock.c,v 1.2.2.1 1999/03/22 05:42:54 jingham Exp $ */ #include "tclInt.h" #include "tclPort.h" #include "tclMacInt.h" #include <AddressXlation.h> #include <Aliases.h> |
︙ | ︙ | |||
78 79 80 81 82 83 84 85 86 87 88 89 90 91 | * TCL_WRITABLE as set by Tcl_WatchFile. */ Tcl_TcpAcceptProc *acceptProc; /* Proc to call on accept. */ ClientData acceptProcData; /* The data for the accept proc. */ wdsEntry dataSegment[2]; /* List of buffers to be written async. */ rdsEntry rdsarray[5+1]; /* Array used when cleaning out recieve * buffers on a closing socket. */ Tcl_Channel channel; /* Channel associated with this socket. */ struct TcpState *nextPtr; /* The next socket on the global socket * list. */ } TcpState; /* * This structure is used by domain name resolver callback. */ | > > > | 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | * TCL_WRITABLE as set by Tcl_WatchFile. */ Tcl_TcpAcceptProc *acceptProc; /* Proc to call on accept. */ ClientData acceptProcData; /* The data for the accept proc. */ wdsEntry dataSegment[2]; /* List of buffers to be written async. */ rdsEntry rdsarray[5+1]; /* Array used when cleaning out recieve * buffers on a closing socket. */ Tcl_Channel channel; /* Channel associated with this socket. */ int writeBufferSize; /* Size of buffer to hold data for * asynchronous writes. */ void *writeBuffer; /* Buffer for async write data. */ struct TcpState *nextPtr; /* The next socket on the global socket * list. */ } TcpState; /* * This structure is used by domain name resolver callback. */ |
︙ | ︙ | |||
1206 1207 1208 1209 1210 1211 1212 | * write isn't in progress and there is room in the output buffers. */ if (!(statePtr->flags & TCP_WRITING) && amount > 0) { if (toWrite < amount) { amount = toWrite; } | > > > > > > > > > > > > > > > > > | > | | 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 | * write isn't in progress and there is room in the output buffers. */ if (!(statePtr->flags & TCP_WRITING) && amount > 0) { if (toWrite < amount) { amount = toWrite; } /* We need to copy the data, otherwise the caller may overwrite * the buffer in the middle of our asynchronous call */ if (amount > statePtr->writeBufferSize) { /* * need to grow write buffer */ if (statePtr->writeBuffer != (void *) NULL) { ckfree(statePtr->writeBuffer); } statePtr->writeBuffer = (void *) ckalloc(amount); statePtr->writeBufferSize = amount; } memcpy(statePtr->writeBuffer, buf, amount); statePtr->dataSegment[0].ptr = statePtr->writeBuffer; statePtr->dataSegment[0].length = amount; statePtr->dataSegment[1].length = 0; InitMacTCPParamBlock(&statePtr->pb, TCPSend); statePtr->pb.ioCompletion = completeUPP; statePtr->pb.tcpStream = tcpStream; statePtr->pb.csParam.send.wdsPtr = (Ptr) statePtr->dataSegment; statePtr->pb.csParam.send.pushFlag = 1; statePtr->pb.csParam.send.userDataPtr = (Ptr) statePtr; |
︙ | ︙ | |||
1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 | statePtr->tcpStream = tcpStream; statePtr->psn = applicationPSN; statePtr->flags = 0; statePtr->checkMask = 0; statePtr->watchMask = 0; statePtr->acceptProc = (Tcl_TcpAcceptProc *) NULL; statePtr->acceptProcData = (ClientData) NULL; statePtr->nextPtr = socketList; socketList = statePtr; return statePtr; } /* *---------------------------------------------------------------------- | > > | 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 | statePtr->tcpStream = tcpStream; statePtr->psn = applicationPSN; statePtr->flags = 0; statePtr->checkMask = 0; statePtr->watchMask = 0; statePtr->acceptProc = (Tcl_TcpAcceptProc *) NULL; statePtr->acceptProcData = (ClientData) NULL; statePtr->writeBuffer = (void *) NULL; statePtr->writeBufferSize = 0; statePtr->nextPtr = socketList; socketList = statePtr; return statePtr; } /* *---------------------------------------------------------------------- |
︙ | ︙ | |||
1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 | for (p = socketList; p != NULL; p = p->nextPtr) { if (p->nextPtr == statePtr) { p->nextPtr = statePtr->nextPtr; break; } } } ckfree((char *) statePtr); } /* *---------------------------------------------------------------------- * * Tcl_MakeTcpClientChannel -- | > > > > > | 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 | for (p = socketList; p != NULL; p = p->nextPtr) { if (p->nextPtr == statePtr) { p->nextPtr = statePtr->nextPtr; break; } } } if (statePtr->writeBuffer != (void *) NULL) { ckfree(statePtr->writeBuffer); } ckfree((char *) statePtr); } /* *---------------------------------------------------------------------- * * Tcl_MakeTcpClientChannel -- |
︙ | ︙ |