From 1cbe6bb7cb39e4aff37c541fa45f56432dbe9d53 Mon Sep 17 00:00:00 2001 From: John Hodge Date: Thu, 4 Oct 2012 21:52:23 +0800 Subject: [PATCH] AcessNative - Handling for connection closures --- AcessNative/ld-acess_src/request.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/AcessNative/ld-acess_src/request.c b/AcessNative/ld-acess_src/request.c index 7a9b3b39..63419d56 100644 --- a/AcessNative/ld-acess_src/request.c +++ b/AcessNative/ld-acess_src/request.c @@ -275,7 +275,7 @@ int ReadData(void *Dest, int MaxLength, int Timeout) if( !ret ) { printf("[ERROR %i] Timeout reading from socket\n", giSyscall_ClientID); - return 0; // Timeout + return -2; // Timeout } #if USE_TCP @@ -289,6 +289,10 @@ int ReadData(void *Dest, int MaxLength, int Timeout) perror("ReadData"); exit(-1); } + if( ret == 0 ) { + fprintf(stderr, "[ERROR %i] Connection closed.\n", giSyscall_ClientID); + exit(0); + } DEBUG_S("%i bytes read from socket\n", ret); -- 2.20.1