From 3927eb8bf12b33895cc974b86f26a00e4e7a6505 Mon Sep 17 00:00:00 2001 From: phamt Date: Thu, 5 Aug 2010 18:49:04 +0000 Subject: [PATCH] Setting xCAT resquest stream to be blocking because if a short request is made along with a long running request, the output of the long running request never returns. git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@6989 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-UI/lib/functions.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/xCAT-UI/lib/functions.php b/xCAT-UI/lib/functions.php index 533c05f67..cefc59f99 100644 --- a/xCAT-UI/lib/functions.php +++ b/xCAT-UI/lib/functions.php @@ -48,15 +48,16 @@ function docmd($cmd, $nr, $args){ // Open socket to submit request $socket = new Net_Socket(); $socket->connect('ssl://localhost', 3001, true, 30); - // Set socket as non-blocking stream - $socket->setBlocking(false); - // Send xCAT request - $socket->write($request->asXML()); - // Get xCAT response - $xml = $socket->readAll(); - // Close socker - $socket->disconnect(); - + $socket->setBlocking(true); // Set socket as blocking stream + $socket->write($request->asXML()); // Send xCAT request + $xml = $socket->readAll(); // Get xCAT response + $status = $socket->getStatus(); + while ($status['unread_bytes']) { + // Do nothing + $status = $socket->getStatus(); + } + $socket->disconnect(); // Close socket + // submit_request() was the old way of sending the xCAT request // It is no longer needed // $xml = submit_request($request,0);