7fe80d37afd296f8db0058f3e444737ff88ff80e
markd
  Mon Jul 26 23:50:19 2010 -0700
address problem of hgTables consuming all available sockets before TIME_WAIT period by using the connection cache. Have hgTable log connection usage information to help ensure this is fixed
diff --git src/hg/hgTables/hgTables.c src/hg/hgTables/hgTables.c
index 7814c53..622e342 100644
--- src/hg/hgTables/hgTables.c
+++ src/hg/hgTables/hgTables.c
@@ -290,7 +290,7 @@
 struct region *getEncodeRegions()
 /* Get encode regions from encodeRegions table. */
 {
-struct sqlConnection *conn = sqlConnect(database);
+struct sqlConnection *conn = hAllocConn(database);
 struct sqlResult *sr;
 char **row;
 struct region *list = NULL, *region;
@@ -306,7 +306,7 @@
     slAddHead(&list, region);
     }
 sqlFreeResult(&sr);
-sqlDisconnect(&conn);
+hFreeConn(&conn);
 return list;
 }
 
@@ -605,7 +605,7 @@
 /* Return TRUE if it looks to be a positional table. */
 {
 boolean result = FALSE;
-struct sqlConnection *conn = sqlConnect(db);
+struct sqlConnection *conn = hAllocConn(db);
 if (sqlTableExists(conn, "chromInfo"))
     {
     char chromName[64];
@@ -618,7 +618,7 @@
 	result = htiIsPositional(hti);
 	}
     }
-sqlDisconnect(&conn);
+hFreeConn(&conn);
 return result;
 }
 
@@ -1789,6 +1789,7 @@
 hgTables();
 
 textOutClose(&compressPipeline);
-
+// FIXME: temporary to track connection resources used
+sqlPrintStats(stderr);
 return 0;
 }