From 5eca3afa9fff4ca146835ba50ed393560fa0a289 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Sun, 14 Mar 1999 19:46:35 +0000 Subject: [PATCH] Do not call ExitThread() on server communication errors. --- scheduler/client.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/scheduler/client.c b/scheduler/client.c index 2a9229d4880..c380fa64c85 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -28,6 +28,17 @@ /*********************************************************************** + * CLIENT_Die + * + * Die on protocol errors or socket close + */ +static void CLIENT_Die( THDB *thdb ) +{ + close( thdb->socket ); + SYSDEPS_ExitThread(); +} + +/*********************************************************************** * CLIENT_ProtocolError */ static void CLIENT_ProtocolError( const char *err, ... ) @@ -39,7 +50,7 @@ static void CLIENT_ProtocolError( const char *err, ... ) fprintf( stderr, "Client protocol error:%p: ", thdb->server_tid ); vfprintf( stderr, err, args ); va_end( args ); - ExitThread(1); + CLIENT_Die( thdb ); } @@ -145,7 +156,7 @@ static unsigned int CLIENT_WaitReply_v( int *len, int *passed_fd, perror("recvmsg"); CLIENT_ProtocolError( "recvmsg\n" ); } - if (!ret) ExitThread(1); /* the server closed the connection; time to die... */ + if (!ret) CLIENT_Die( thdb ); /* the server closed the connection; time to die... */ /* sanity checks */ @@ -189,7 +200,7 @@ static unsigned int CLIENT_WaitReply_v( int *len, int *passed_fd, perror( "recv" ); CLIENT_ProtocolError( "recv\n" ); } - if (!addlen) ExitThread(1); /* the server closed the connection; time to die... */ + if (!addlen) CLIENT_Die( thdb ); /* the server closed the connection; time to die... */ if (len) *len += addlen; remaining -= addlen; } @@ -206,7 +217,7 @@ static unsigned int CLIENT_WaitReply_v( int *len, int *passed_fd, perror( "recv" ); CLIENT_ProtocolError( "recv\n" ); } - if (!addlen) ExitThread(1); /* the server closed the connection; time to die... */ + if (!addlen) CLIENT_Die( thdb ); /* the server closed the connection; time to die... */ remaining -= addlen; } -- 2.11.4.GIT