AcessNative - Handling for connection closures
authorJohn Hodge <[email protected]>
Thu, 4 Oct 2012 13:52:23 +0000 (21:52 +0800)
committerJohn Hodge <[email protected]>
Thu, 4 Oct 2012 13:52:23 +0000 (21:52 +0800)
AcessNative/ld-acess_src/request.c

index 7a9b3b3..63419d5 100644 (file)
@@ -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);
        

UCC git Repository :: git.ucc.asn.au