Index: trunk/Ohana/src/opihi/pcontrol/CheckHost.c
===================================================================
--- trunk/Ohana/src/opihi/pcontrol/CheckHost.c	(revision 10652)
+++ trunk/Ohana/src/opihi/pcontrol/CheckHost.c	(revision 17475)
@@ -1,8 +1,9 @@
 # include "pcontrol.h"
 
+// if the host has a job, we skip it (down or crash state will be caught elsewhere)
+// in fact, just touch the IDLE hosts, not the BUSY hosts?
 int CheckHost (Host *host) {
   
   int status;
-  IOBuffer buffer;
 
   ASSERT (host, "host not set");
@@ -18,30 +19,35 @@
   }
 
-  InitIOBuffer (&buffer, 0x100);
+  // the argument to echo (OK) is the expected response below in CheckHostResponse
+  status = PclientCommand (host, "echo OK", PCLIENT_PROMPT, PCONTROL_RESP_CHECK_HOST);
 
-  status = PclientCommand (host, "echo OK", PCLIENT_PROMPT, &buffer);
   switch (status) {
-    case 0:
+    case PCLIENT_DOWN:
       if (VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname);
       HarvestHost (host[0].pid);
       PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);
-      FreeIOBuffer (&buffer);
       return (FALSE);
       
-    case -1:
-      if (VerboseMode()) gprint (GP_ERR, "host %s is not responding\n", host[0].hostname);
-      /*** do we mark this in some way (HUNG) ? ***/
-      PutHost (host, host[0].stack, STACK_BOTTOM);
-      FreeIOBuffer (&buffer);
-      return (FALSE);
+    case PCLIENT_GOOD:
+      PutHost (host, PCONTROL_HOST_RESP, STACK_BOTTOM);
+      return (TRUE);
 
     default:
-      PutHost (host, host[0].stack, STACK_BOTTOM);
-      FreeIOBuffer (&buffer);
-      return (TRUE);
+      ABORT ("unknown status for pclient command");  
   }
-  ABORT ("should not reach here (Check Host)"); 
+  ABORT ("should not reach here (CheckHost)"); 
 }
 
-// if the host has a job, we skip it (down or crash state will be caught elsewhere)
-// in fact, just touch the IDLE hosts, not the BUSY hosts?
+int CheckHostResponse (Host *host) {
+  
+  IOBuffer *buffer;
+
+  /* we only check IDLE hosts without jobs */
+  ASSERT (host, "missing host");
+  buffer = &host[0].comms_buffer;
+
+  // XXX check on the value of the response? (OK)
+
+  PutHost (host, PCONTROL_HOST_IDLE, STACK_BOTTOM);
+  return (TRUE);
+}
