From: John Hodge Date: Wed, 5 Jan 2011 06:24:56 +0000 (+0845) Subject: Added check for second WaitForColon X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=94a66383f886eaecb7ff641785117247784900c8;p=tpg%2Fopendispense2.git Added check for second WaitForColon --- diff --git a/src/server/handler_coke.c b/src/server/handler_coke.c index ad5387f..cd02fa7 100644 --- a/src/server/handler_coke.c +++ b/src/server/handler_coke.c @@ -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);