ci-test #1

Merged
palkan merged 9 commits from ci-test into develop 2023-01-22 08:57:27 +00:00
1 changed files with 12 additions and 12 deletions
Showing only changes of commit b4ec5c915b - Show all commits

View File

@ -22,16 +22,16 @@ $connection=null;
$channel=null;
while(1) {
while (1) {
try {
$connection=rabbitConnect($rabbitHost,$rabbitPort,$rabbitLogin,$rabbitPass,$rabbitUseSSL);
$connection=rabbitConnect($rabbitHost, $rabbitPort, $rabbitLogin, $rabbitPass, $rabbitUseSSL);
$channel=$connection->channel();
scanner($channel,$port);
scanner($channel, $port);
} catch (Exception $e) {
print "Exception ".$e->getMessage()."\n";
$channel->close();
$connection->close();
$s=rand(5,15);
$s=rand(5, 15);
print "Sleep $s seconds..";
sleep($s);
print "Ok\n";
@ -47,9 +47,9 @@ function rabbitConnect($rabbitHost, $rabbitPort, $rabbitLogin, $rabbitPass, $rab
'allow_self_signed' => false
];
$connection = new AMQPSSLConnection($rabbitHost, $rabbitPort, $rabbitLogin, $rabbitPass,$rabbitVirtualHost,$ssl_opts);
$connection = new AMQPSSLConnection($rabbitHost, $rabbitPort, $rabbitLogin, $rabbitPass, $rabbitVirtualHost, $ssl_opts);
} else {
$connection = new AMQPStreamConnection($rabbitHost, $rabbitPort, $rabbitLogin, $rabbitPass,$rabbitVirtualHost);
$connection = new AMQPStreamConnection($rabbitHost, $rabbitPort, $rabbitLogin, $rabbitPass, $rabbitVirtualHost);
}
return $connection;
}
@ -68,9 +68,9 @@ function scanner($channel, $port) {
}
}
while(1) {
$buffer = fgets($fp,4096);
$rv=explode("\n",$buffer);
while (1) {
$buffer = fgets($fp, 4096);
$rv=explode("\n", $buffer);
if ($buffer === false) {
if (!empty($routingTag)) {
$msg = new AMQPMessage(json_encode(["type"=>"service","data"=>"scannerFailed"]));
@ -79,7 +79,7 @@ function scanner($channel, $port) {
throw new Exception("Stream read failed. Scanner disconnected?");
}
if (preg_match('/^fxc([0-9a-f]{20})xf$/',$buffer,$ref)) {
if (preg_match('/^fxc([0-9a-f]{20})xf$/', $buffer, $ref)) {
print "Pairing request. Routing tag: $ref[1]\n";
$routingTag=$ref[1];
$msg = new AMQPMessage(json_encode(["type"=>"service","data"=>"scannerRegistered"]));