From b45b84a505c294e2e2c9656ac1e8f409fb932baa Mon Sep 17 00:00:00 2001 From: jshalf Date: Wed, 1 Nov 2000 05:22:48 +0000 Subject: Ignore SIGPIPE. Try to figure out why we get periodic crashes on IsoView disconnect. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IsoSurfacer/trunk@18 bfcf8e34-485d-4d46-a995-1fd6fa6fb178 --- src/Sockets.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Sockets.c b/src/Sockets.c index 05d96ed..7556424 100644 --- a/src/Sockets.c +++ b/src/Sockets.c @@ -41,6 +41,10 @@ #endif /* HAVE_WINSOCK2_H */ #include +#ifndef WIN32 +#include +#endif + #include "IsoSurfacerInit.h" #include "IsoSurfacerGH.h" @@ -370,9 +374,18 @@ IsoCommand *Iso_PollCommand(cGH *GH,IsoCommand *cmd){ /* get next command on the control socket list */ for(this = controlsocklist; this; this = this->next){ if(FD_ISSET (this->filedes, &read_fd_set)){ + int r; + /* puts("StartIsoRead"); */ + r=Iso_Read(this,cmd->buffer,64+64+64); + /* puts("EndIsoRead"); */ /* Data arriving on an already-connected socket. */ - if (Iso_Read (this, cmd->buffer,64+64+64) <= 0){ + if (r <= 0){ + puts("Destroy Socket"); SocketDestroy(this, &controlsocklist); + puts("done destroy"); + if(controlsocklist==NULL) puts("*********It did the right thing"); + else puts("*******baaad socket... bad bad bad..."); + return NULL; } else return cmd; /* return immediately with the new command (first available) */ } @@ -930,6 +943,8 @@ static int InitialiseTCP(void) static int InitialiseTCP(void) { + /* Make sure we ignore SIGPIPE */ + signal(SIGPIPE,SIG_IGN); return 0; } -- cgit v1.2.3