Index: /trunk/Ohana/src/opihi/pantasks/ControllerOps.c
===================================================================
--- /trunk/Ohana/src/opihi/pantasks/ControllerOps.c	(revision 18078)
+++ /trunk/Ohana/src/opihi/pantasks/ControllerOps.c	(revision 18079)
@@ -1,6 +1,6 @@
 # include "pantasks.h"
 /* adding a new host can delay controller up to a second or so */
-# define CONTROLLER_TIMEOUT 1000
-# define CONNECT_TIMEOUT 300
+# define CONTROLLER_TIMEOUT 5000
+# define CONNECT_TIMEOUT 1000
 
 /* local static variables to hold the connection to the controller */
@@ -88,14 +88,20 @@
   /** parse status message **/
   p = memstr (buffer.buffer, "STATUS",   buffer.Nbuffer);
+  if (p == NULL) goto escape;
   sscanf (p, "%*s %s", status_string);
   p = memstr (buffer.buffer, "EXITST",   buffer.Nbuffer);
+  if (p == NULL) goto escape;
   sscanf (p, "%*s %d", &job[0].exit_status);
   p = memstr (buffer.buffer, "STDOUT",   buffer.Nbuffer);
+  if (p == NULL) goto escape;
   sscanf (p, "%*s %d", &job[0].stdout_size);
   p = memstr (buffer.buffer, "STDERR",   buffer.Nbuffer);
+  if (p == NULL) goto escape;
   sscanf (p, "%*s %d", &job[0].stderr_size);
   p = memstr (buffer.buffer, "DTIME",    buffer.Nbuffer);
+  if (p == NULL) goto escape;
   sscanf (p, "%*s %lf", &job[0].dtime);
   p = memstr (buffer.buffer, "HOSTNAME", buffer.Nbuffer);
+  if (p == NULL) goto escape;
   sscanf (p, "%*s %s", string);
   job[0].realhost = strcreate (string);
@@ -109,10 +115,13 @@
   if (!strcmp(status_string, "EXIT"))    outstate = JOB_EXIT;
   if (!strcmp(status_string, "CRASH"))   outstate = JOB_CRASH;
-  if (outstate == -1) {
-    gprint (GP_ERR, "programming error?\n");
-    exit (1);
-  }
+  if (outstate == -1) goto escape;
+
   job[0].state = outstate;
   return (TRUE);
+
+  escape:
+  gprint (GP_ERR, "garbage in pcontrol reponse\n");
+  FreeIOBuffer (&buffer);
+  return (FALSE);
 }
 
@@ -297,5 +306,5 @@
     status = ReadtoIOBuffer (&buffer, stdout_fd[0]);
     p = memstr (buffer.buffer, "CONNECTED", buffer.Nbuffer);
-    usleep (10000); // wait for controller to start up
+    usleep (50000); // wait for controller to start up
   }
   if (status == 0) goto pipe_error;
