Changed client not to keep a persistent connection when choosing items
authorJohn Hodge <[email protected]>
Sat, 19 Feb 2011 06:15:54 +0000 (14:15 +0800)
committerJohn Hodge <[email protected]>
Sat, 19 Feb 2011 06:15:54 +0000 (14:15 +0800)
src/client/main.c

index 72dffdf..3ca9593 100644 (file)
@@ -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 <name>`
@@ -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);

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