add .gitignore
[remotetop.git] / topd.c
diff --git a/topd.c b/topd.c
index 1f1378c..870fbc1 100644 (file)
--- a/topd.c
+++ b/topd.c
@@ -94,7 +94,7 @@ main( int argc, char *argv[] ) {
                }
        }
 
-       if (!host);
+       if (!host)
                usage();
 
        signal(SIGCHLD, SIG_IGN);
@@ -120,7 +120,7 @@ main( int argc, char *argv[] ) {
                        cfg.mu = allocUnits(n);
 
                        TC_addConnection( &cfg.pool, TC_fillConnection(NULL, NULL, listenport) );
-                       TC_ClientInitConnection( cfg.pool.conn[0], NULL, listenport);
+                       TC_ClientInitConnection( cfg.pool.conn[0], host, listenport);
                        cfg.pool.conn[0]->state = CS_READ;
 
                        TC_addConnection( &cfg.pool, TC_fillConnection(NULL, NULL, listenport) );
@@ -143,9 +143,8 @@ main( int argc, char *argv[] ) {
                                        }
                                }
                        }
-                       TC_deleteConnectionByN(&cfg.pool, 0);
-                       close( cfg.pool.conn[1]->fd );
-                       for(i=TC_SERVER_CONN_START; i<cfg.pool.number; i++) 
+
+                       for(i=cfg.pool.number-1; i>=0; i--) 
                                TC_deleteConnectionByN(&cfg.pool,i);
                }
        }