IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 6, 2013, 11:12:46 AM (13 years ago)
Author:
eugene
Message:

handle case where only some of hosts were used for connection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20121219/Ohana/src/libdvo/src/HostTable.c

    r33963 r35091  
    243243  Nmax ++;
    244244
     245  // need the list of connected hosts for exit test below
     246  int Nrunning = 0;
     247  for (i = 0; i < table->Nhosts; i++) {
     248    if (!table->hosts[i].pid) continue; // any unconnected hosts should be skipped
     249    Nrunning ++;
     250  }
     251
    245252  int Nfound = 0;
    246253
     
    262269    // we have some sockets to check, check sockets for all hosts
    263270    for (i = 0; (status > 0) && (i < table->Nhosts); i++) {
     271      if (!table->hosts[i].pid) continue; // any unconnected hosts should be skipped
     272
    264273      if (FALSE && FD_ISSET (table->hosts[i].stdio[HOST_STDIN], &wtSet)) {
    265274        // this host is waiting for input : this is an error, so exit
     
    268277      }
    269278     
    270       if (FD_ISSET (table->hosts[i].stdio[HOST_STDOUT], &rdSet)) {
     279      if ((table->hosts[i].stdio[HOST_STDOUT] > 0) && FD_ISSET (table->hosts[i].stdio[HOST_STDOUT], &rdSet)) {
    271280        // this host has waiting output : read to buffer, and dump if necessary
    272281        ReadtoIOBuffer (&table->hosts[i].stdout, table->hosts[i].stdio[HOST_STDOUT]);
     
    282291      }
    283292
    284       if (FD_ISSET (table->hosts[i].stdio[HOST_STDERR], &rdSet)) {
     293      if ((table->hosts[i].stdio[HOST_STDERR] > 0) && FD_ISSET (table->hosts[i].stdio[HOST_STDERR], &rdSet)) {
    285294        // this host has waiting output : read to buffer, and dump if necessary
    286295        ReadtoIOBuffer (&table->hosts[i].stderr, table->hosts[i].stdio[HOST_STDERR]);
     
    361370      }
    362371      Nfound ++;
    363       if (Nfound == table->Nhosts) goto escape; // we've harvested all jobs
     372      if (Nfound == Nrunning) goto escape; // we've harvested all jobs
    364373    }
    365374  }
Note: See TracChangeset for help on using the changeset viewer.