|
From: Brenda L. <asp...@us...> - 2003-05-13 22:27:26
|
Update of /cvsroot/squeak/squeak/platforms/unix/plugins/SocketPlugin In directory sc8-pr-cvs1:/tmp/cvs-serv21322/SocketPlugin Modified Files: sqUnixSocket.c Log Message: Ian Piumarta's release 3.5-1devel Index: sqUnixSocket.c =================================================================== RCS file: /cvsroot/squeak/squeak/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** sqUnixSocket.c 12 May 2003 07:39:04 -0000 1.5 --- sqUnixSocket.c 13 May 2003 22:27:10 -0000 1.6 *************** *** 5,8 **** --- 5,12 ---- * All rights reserved. * + * You are NOT ALLOWED to distribute modified versions of this file + * under its original name. If you want to modify it and then make + * your modifications available publicly, rename the file first. + * * This file is part of Unix Squeak. * *************** *** 13,17 **** * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of ! * this distribution, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not --- 17,21 ---- * You may use and/or distribute this file ONLY as part of Squeak, under * the terms of the Squeak License as described in `LICENSE' in the base of ! * this distribution, subject to the following additional restrictions: * * 1. The origin of this software must not be misrepresented; you must not *************** *** 21,38 **** * would be appreciated but is not required. * ! * 2. This notice must not be removed or altered in any source distribution. * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. - * - * You are not allowed to distribute a modified version of this file - * under its original name without explicit permission to do so. If - * you change it, rename it. */ /* Author: Ian...@in... * ! * Last edited: 2003-01-31 12:02:24 by piumarta on emilia.local. * * Support for BSD-style "accept" primitives contributed by: --- 25,41 ---- * would be appreciated but is not required. * ! * 2. You must not distribute (or make publicly available by any ! * means) a modified copy of this file unless you first rename it. ! * ! * 3. This notice must not be removed or altered in any source distribution. * * Using (or modifying this file for use) in any context other than Squeak * changes these copyright conditions. Read the file `COPYING' in the * directory `platforms/unix/doc' before proceeding with any such use. */ /* Author: Ian...@in... * ! * Last edited: 2003-02-27 19:51:04 by piumarta on emilia.inria.fr * * Support for BSD-style "accept" primitives contributed by: *************** *** 142,145 **** --- 145,150 ---- #define ThisEndClosed 4 + #define LINGER_SECS 1 + static int thisNetSession= 0; static int one= 1; *************** *** 241,244 **** --- 246,256 ---- /*** miscellaneous sundries ***/ + /* set linger on a connected stream */ + + static void setLinger(int fd, int flag) + { + struct linger linger= { flag, flag * LINGER_SECS }; + setsockopt(fd, SOL_SOCKET, SO_LINGER, (char *)&linger, sizeof(linger)); + } /* answer the hostname for the given IP address */ *************** *** 361,366 **** { pss->sockState= Connected; ! ! if (pss->multiListen) { --- 373,377 ---- { pss->sockState= Connected; ! setLinger(newSock, 1); if (pss->multiListen) { *************** *** 407,410 **** --- 418,422 ---- { pss->sockState= Connected; + setLinger(pss->s, 1); } } *************** *** 606,610 **** PSP(s)->multiListen= (backlogSize > 1); ! FPRINTF((stderr, "listenOnPortBacklogSize(%d)\n", SOCKET(s))); memset(&saddr, 0, sizeof(saddr)); saddr.sin_family= AF_INET; --- 618,622 ---- PSP(s)->multiListen= (backlogSize > 1); ! FPRINTF((stderr, "listenOnPortBacklogSize(%d, %d)\n", SOCKET(s), backlogSize)); memset(&saddr, 0, sizeof(saddr)); saddr.sin_family= AF_INET; *************** *** 659,662 **** --- 671,675 ---- SOCKETSTATE(s)= Connected; notify(PSP(s), CONN_NOTIFY); + setLinger(SOCKET(s), 1); } else *************** *** 764,767 **** --- 777,781 ---- SOCKETERROR(s)= errno; notify(PSP(s), CONN_NOTIFY); + perror("closeConnection"); } else if (0 == result) *************** *** 769,772 **** --- 783,787 ---- /* close completed synchronously */ SOCKETSTATE(s)= Unconnected; + FPRINTF((stderr, "closeConnection: disconnected\n")); SOCKET(s)= 0; } *************** *** 776,779 **** --- 791,795 ---- SOCKETSTATE(s)= ThisEndClosed; aioHandle(SOCKET(s), closeHandler, AIO_RWX); /* => close() done */ + FPRINTF((stderr, "closeConnection: deferred [aioHandle is set]\n")); } } *************** *** 784,794 **** void sqSocketAbortConnection(SocketPtr s) { - struct linger linger= { 0, 0 }; - FPRINTF((stderr, "abortConnection(%d)\n", SOCKET(s))); if (!socketValid(s)) return; ! ! setsockopt(SOCKET(s), SOL_SOCKET, SO_LINGER, (char *)&linger, sizeof(linger)); sqSocketCloseConnection(s); } --- 800,807 ---- void sqSocketAbortConnection(SocketPtr s) { FPRINTF((stderr, "abortConnection(%d)\n", SOCKET(s))); if (!socketValid(s)) return; ! setLinger(SOCKET(s), 0); sqSocketCloseConnection(s); } |