Update of /cvsroot/squeak/squeak/platforms/unix/plugins/SocketPlugin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2361
Modified Files:
sqUnixSocket.c
Log Message:
Disable aio on disconnection. Additional tests for pss == NULL.
Index: sqUnixSocket.c
===================================================================
RCS file: /cvsroot/squeak/squeak/platforms/unix/plugins/SocketPlugin/sqUnixSocket.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** sqUnixSocket.c 2 Apr 2004 00:58:33 -0000 1.13
--- sqUnixSocket.c 3 Apr 2004 10:22:04 -0000 1.14
***************
*** 37,41 ****
/* Author: Ian...@in...
*
! * Last edited: 2003-09-16 20:06:06 by piumarta on emilia.inria.fr
*
* Support for BSD-style "accept" primitives contributed by:
--- 37,41 ----
/* Author: Ian...@in...
*
! * Last edited: 2004-04-02 14:21:17 by piumarta on emilia.local
*
* Support for BSD-style "accept" primitives contributed by:
***************
*** 368,371 ****
--- 368,372 ----
pss->sockState= Invalid;
perror("acceptHandler");
+ aioDisable(fd);
close(fd);
fprintf(stderr, "acceptHandler: aborting server %d pss=%p\n", fd, pss);
***************
*** 433,436 ****
--- 434,443 ----
FPRINTF((stderr, "dataHandler(%d=%d, %p, %d)\n", fd, pss->s, data, flags));
+ if (pss == NULL)
+ {
+ fprintf(stderr, "dataHandler: pss is NULL fd=%d data=%p flags=0x%x\n", fd, data, flags);
+ return;
+ }
+
if (flags & AIO_R)
{
***************
*** 438,442 ****
if (n == 0)
{
! fprintf(stderr, "dataHandler: selected socket would block (why?)\n");
}
if (n != 1)
--- 445,449 ----
if (n == 0)
{
! fprintf(stderr, "dataHandler: selected socket fd=%d flags=0x%x would block (why?)\n", fd, flags);
}
if (n != 1)
***************
*** 545,548 ****
--- 552,561 ----
/* private socket structure */
pss= (privateSocketStruct *)calloc(1, sizeof(privateSocketStruct));
+ if (pss == NULL)
+ {
+ fprintf(stderr, "acceptFrom: out of memory\n");
+ interpreterProxy->success(false);
+ return;
+ }
pss->s= newSocket;
pss->connSema= semaIndex;
***************
*** 745,749 ****
if (PSP(serverSocket)->acceptedSock < 0)
{
! printf("acceptFrom: no socket available\n");
interpreterProxy->success(false);
return;
--- 758,762 ----
if (PSP(serverSocket)->acceptedSock < 0)
{
! fprintf(stderr, "acceptFrom: no socket available\n");
interpreterProxy->success(false);
return;
***************
*** 752,759 ****
/* got connection -- fill in the structure */
s->sessionID= 0;
! pss= calloc(1, sizeof(*pss));
if (pss == NULL)
{
! printf("acceptFrom: out of memory\n");
interpreterProxy->success(false);
return;
--- 765,772 ----
/* got connection -- fill in the structure */
s->sessionID= 0;
! pss= (privateSocketStruct *)calloc(1, sizeof(privateSocketStruct));
if (pss == NULL)
{
! fprintf(stderr, "acceptFrom: out of memory\n");
interpreterProxy->success(false);
return;
|