Guard socket and FTL response

Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
Christian König
2022-04-05 14:55:40 +02:00
committed by Adam Warner
parent 338c90d06a
commit 45340aaa23
2 changed files with 211 additions and 186 deletions

View File

@@ -79,7 +79,9 @@ function getResponseFTL($socket) {
}
function disconnectFTL($socket) {
if (is_resource($socket)) {
fclose($socket);
}
}
function callFTLAPI($request, $FTL_IP = DEFAULT_FTL_IP, $port = DEFAULT_FTL_PORT) {
@@ -92,7 +94,6 @@ function callFTLAPI($request, $FTL_IP = DEFAULT_FTL_IP, $port = DEFAULT_FTL_PORT
$data = getResponseFTL($socket);
}
disconnectFTL($socket);
return $data;
}
?>