From: John Hodge Date: Sat, 19 Feb 2011 06:15:54 +0000 (+0800) Subject: Changed client not to keep a persistent connection when choosing items X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=1d96d446ce969166330936ef990b304693cd28bd;p=tpg%2Fopendispense2.git Changed client not to keep a persistent connection when choosing items --- diff --git a/src/client/main.c b/src/client/main.c index 72dffdf..3ca9593 100644 --- a/src/client/main.c +++ b/src/client/main.c @@ -295,13 +295,13 @@ int main(int argc, char *argv[]) // Connect to server sock = OpenConnection(gsDispenseServer, giDispensePort); if( sock < 0 ) return -1; - - // Authenticate - Authenticate(sock); // Get items PopulateItemList(sock); + // Disconnect from server + close(sock); + if( gsItemPattern ) { // TODO: Implement `dispense ` @@ -345,6 +345,14 @@ int main(int argc, char *argv[]) } } + + // Connect to server again + sock = OpenConnection(gsDispenseServer, giDispensePort); + if( sock < 0 ) return -1; + + // Authenticate + Authenticate(sock); + // Check for a valid item ID if( i >= 0 ) DispenseItem(sock, i);