Adjustments to event_socket_request to make it faster.

This commit is contained in:
markjcrane
2015-07-05 23:08:10 -06:00
parent b0e24db2fa
commit 4742fac8f9

View File

@@ -322,9 +322,7 @@ function event_socket_request($fp, $cmd) {
}
fputs($fp, "\n"); //second line feed to end the headers
usleep(100); //allow time for reponse
$response = "";
$response = '';
$i = 0;
$content_length = 0;
while (!feof($fp)) {
@@ -342,17 +340,16 @@ function event_socket_request($fp, $cmd) {
}
}
usleep(50); //allow time for reponse
//prevent an endless loop //optional because of script timeout
if ($i > 30000) { break; }
if ($content_length > 0) { //is content_length set
//stop reading if all content has been read.
if (strlen($response) >= $content_length) {
break;
}
}
else {
//prevent an endless loop
if ($i > 300000) { break; }
}
$i++;
}
@@ -364,6 +361,8 @@ function event_socket_request($fp, $cmd) {
}
function event_socket_request_cmd($cmd) {
global $db, $domain_uuid, $host;