Index: trunk/Ohana/src/opihi/pcontrol/CheckDoneHost.c
===================================================================
--- trunk/Ohana/src/opihi/pcontrol/CheckDoneHost.c	(revision 10668)
+++ trunk/Ohana/src/opihi/pcontrol/CheckDoneHost.c	(revision 17475)
@@ -5,12 +5,8 @@
   
   int       status;
-  char     *p;
-  IOBuffer  buffer;
 
   ASSERT (host, "host not set");
 
-  InitIOBuffer (&buffer, 0x100);
-  
-  status = PclientCommand (host, "reset", PCLIENT_PROMPT, &buffer);
+  status = PclientCommand (host, "reset", PCLIENT_PROMPT, PCONTROL_RESP_CHECK_DONE_HOST);
 
   /* check on success of pclient command */
@@ -18,28 +14,34 @@
     case PCLIENT_DOWN:
       if (DEBUG || VerboseMode()) gprint (GP_ERR, "host %s is down\n", host[0].hostname);
-      /* DONE host does not have an incomplete job */
       HarvestHost (host[0].pid);
       PutHost (host, PCONTROL_HOST_DOWN, STACK_BOTTOM);
-      FreeIOBuffer (&buffer);
       return (FALSE);
+      /* DONE host does not have an incomplete job */
       // XXX do we need to close the connection?
 
-    case PCLIENT_HUNG:
-      // don't do anything drastic, just try again later
-      PutHost (host, PCONTROL_HOST_DONE, STACK_BOTTOM);
-      if (DEBUG || VerboseMode()) gprint (GP_ERR, "host %s is not responding\n", host[0].hostname);
-      FreeIOBuffer (&buffer);
-      return (FALSE);
-
     case PCLIENT_GOOD:
-      if (VerboseMode()) gprint (GP_ERR, "message received (CheckDoneHost)\n");  
-      break;
+      if (VerboseMode()) gprint (GP_ERR, "checking done host %s\n", host[0].hostname);  
+      PutHost (host, PCONTROL_HOST_RESP, STACK_BOTTOM);
+      return (TRUE);
 
     default:
       ABORT ("unknown status for pclient command");  
   }
+  ABORT ("should not reach here (CheckDoneHost)"); 
+}
+
+int CheckDoneHostResponse (Host *host) {
+
+  int status;
+  char *p;
+  IOBuffer *buffer;
+
+  /* job must have assigned host */
+  ASSERT (host, "missing host");
+  ASSERT (host[0].job, "missing job");
+  buffer = &host[0].comms_buffer;
 
   /** successful command, examine result **/
-  p = memstr (buffer.buffer, "STATUS", buffer.Nbuffer);
+  p = memstr (buffer[0].buffer, "STATUS", buffer[0].Nbuffer);
   ASSERT (p != NULL, "missing STATUS in pclient message (CheckDoneHost)");
 
@@ -52,5 +54,4 @@
       if (DEBUG || VerboseMode()) gprint (GP_ERR, "reset failed\n");
       PutHost (host, PCONTROL_HOST_DONE, STACK_BOTTOM);
-      FreeIOBuffer (&buffer);
       return (FALSE);
       
@@ -59,5 +60,4 @@
       if (DEBUG || VerboseMode()) gprint (GP_ERR, "successful reset\n");
       PutHost (host, PCONTROL_HOST_IDLE, STACK_BOTTOM);
-      FreeIOBuffer (&buffer);
       return (FALSE);
 
@@ -67,5 +67,2 @@
   ABORT ("should not reach here (CheckDoneHost)");
 }
-
-/** probably need to flush the buffer before the command **/
-/** need to add timeout check here **/
