Changeset 20032
- Timestamp:
- Oct 9, 2008, 2:18:56 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/pantasks/ControllerOps.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/pantasks/ControllerOps.c
r19125 r20032 159 159 return (TRUE); 160 160 161 escape:161 escape: 162 162 gprint (GP_ERR, "garbage in pcontrol reponse\n"); 163 163 FreeIOBuffer (&buffer); … … 411 411 if ((status == -1) && (errno == EPIPE)) { 412 412 StopController (); 413 gprint (GP_ERR, "controller is down , restarting\n");413 gprint (GP_ERR, "controller is down (pipe closed), restarting\n"); 414 414 if (!RestartController ()) { 415 415 return (FALSE); … … 420 420 /* for commands which don't return a prompt, don't look for one */ 421 421 if (response == NULL) { 422 return (TRUE);422 return (TRUE); 423 423 } 424 424 … … 427 427 status = -1; 428 428 for (j = 0; (status == -1) && (j < 10); j++) { 429 for (i = 0; (i < CONTROLLER_TIMEOUT) && (status != 0) && (line == NULL); i++) { 430 status = ReadtoIOBuffer (buffer, stdout_cntl); 431 line = memstr (buffer[0].buffer, response, buffer[0].Nbuffer); 432 if (status == -1) nanosleep (&request, &remain); 429 for (i = 0; (i < CONTROLLER_TIMEOUT) && (status != 0) && (line == NULL); i++) { 430 status = ReadtoIOBuffer (buffer, stdout_cntl); 431 line = memstr (buffer[0].buffer, response, buffer[0].Nbuffer); 432 if (status == -1) nanosleep (&request, &remain); 433 } 434 if (status == 0) { 435 StopController (); 436 gprint (GP_ERR, "controller is down (EOF), restarting\n"); 437 if (!RestartController ()) { 438 return (FALSE); 433 439 } 434 if (status == 0) { 435 StopController (); 436 gprint (GP_ERR, "controller is down\n"); 437 return (FALSE); 438 } 439 if (status == -1) { 440 gprint (GP_ERR, "controller is not responding (%d tries)\n", j); 441 gwrite (buffer[0].buffer, 1, buffer[0].Nbuffer, GP_ERR); 442 } 440 return (FALSE); 441 } 442 if (status == -1) { 443 gprint (GP_ERR, "controller is not responding (%d tries)\n", j); 444 gwrite (buffer[0].buffer, 1, buffer[0].Nbuffer, GP_ERR); 445 } 443 446 } 444 447 if (status == -1) { 445 gprint (GP_ERR, "controller still not responding, giving up\n");446 return (FALSE);448 gprint (GP_ERR, "controller still not responding, giving up\n"); 449 return (FALSE); 447 450 } 448 451 … … 570 573 IOBuffer buffer; 571 574 572 gprint (GP_ERR, " controller is down, restarting\n");575 gprint (GP_ERR, "attempting to restart pcontrol\n"); 573 576 if (!StartController ()) { 574 577 gprint (GP_ERR, "failure to re-start pcontrol\n"); … … 579 582 580 583 // XXX lock the host table? SerialThreadLock (); 581 fprintf (stderr, "controller is down, restarting\n");584 gprint (GP_ERR, "pcontrol restarted, reloading hosts\n"); 582 585 for (i = 0; i < Nhosts; i++) { 583 fprintf (stderr, "controller host add %s -threads %d\n", hosts[i].hostname, hosts[i].max_threads);584 586 snprintf (command, 256, "host add %s -threads %d\n", hosts[i].hostname, hosts[i].max_threads); 587 gprint (GP_ERR, "sending: %s\n", command); 585 588 status = ControllerCommand (command, CONTROLLER_PROMPT, &buffer); 586 589 }
Note:
See TracChangeset
for help on using the changeset viewer.
