Index: branches/eam_branches/ipp-20121219/Ohana/src/libdvo/src/HostTable.c
===================================================================
--- branches/eam_branches/ipp-20121219/Ohana/src/libdvo/src/HostTable.c	(revision 35090)
+++ branches/eam_branches/ipp-20121219/Ohana/src/libdvo/src/HostTable.c	(revision 35091)
@@ -243,4 +243,11 @@
   Nmax ++;
 
+  // need the list of connected hosts for exit test below
+  int Nrunning = 0;
+  for (i = 0; i < table->Nhosts; i++) {
+    if (!table->hosts[i].pid) continue; // any unconnected hosts should be skipped
+    Nrunning ++;
+  }
+
   int Nfound = 0;
 
@@ -262,4 +269,6 @@
     // we have some sockets to check, check sockets for all hosts
     for (i = 0; (status > 0) && (i < table->Nhosts); i++) {
+      if (!table->hosts[i].pid) continue; // any unconnected hosts should be skipped
+
       if (FALSE && FD_ISSET (table->hosts[i].stdio[HOST_STDIN], &wtSet)) {
 	// this host is waiting for input : this is an error, so exit
@@ -268,5 +277,5 @@
       }
       
-      if (FD_ISSET (table->hosts[i].stdio[HOST_STDOUT], &rdSet)) {
+      if ((table->hosts[i].stdio[HOST_STDOUT] > 0) && FD_ISSET (table->hosts[i].stdio[HOST_STDOUT], &rdSet)) {
 	// this host has waiting output : read to buffer, and dump if necessary
 	ReadtoIOBuffer (&table->hosts[i].stdout, table->hosts[i].stdio[HOST_STDOUT]);
@@ -282,5 +291,5 @@
       }
 
-      if (FD_ISSET (table->hosts[i].stdio[HOST_STDERR], &rdSet)) {
+      if ((table->hosts[i].stdio[HOST_STDERR] > 0) && FD_ISSET (table->hosts[i].stdio[HOST_STDERR], &rdSet)) {
 	// this host has waiting output : read to buffer, and dump if necessary
 	ReadtoIOBuffer (&table->hosts[i].stderr, table->hosts[i].stdio[HOST_STDERR]);
@@ -361,5 +370,5 @@
       }
       Nfound ++;
-      if (Nfound == table->Nhosts) goto escape; // we've harvested all jobs
+      if (Nfound == Nrunning) goto escape; // we've harvested all jobs
     }
   }
