Added check for second WaitForColon
authorJohn Hodge <[email protected]>
Wed, 5 Jan 2011 06:24:56 +0000 (15:09 +0845)
committerJohn Hodge <[email protected]>
Wed, 5 Jan 2011 06:24:56 +0000 (15:09 +0845)
src/server/handler_coke.c

index ad5387f..cd02fa7 100644 (file)
@@ -71,7 +71,10 @@ int Coke_CanDispense(int User, int Item)
        sprintf(tmp, "s%i\r\n", Item);
        write(giCoke_SerialFD, tmp, 4);
        
-       WaitForColon();
+       if( WaitForColon() ) {
+               fprintf(stderr, "Coke machine timed out (after initial)\n");
+               return -2;      // -EMYBAD
+       }
 
        ret = ReadLine(sizeof(tmp)-1, tmp);
        printf("ret = %i, tmp = '%s'\n", ret, tmp);

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