Skip to content

Commit

Permalink
Updated flag in AMQP::Address when no TLS certificate provided
Browse files Browse the repository at this point in the history
Signed-off-by: Loic Pottier <pottier1@llnl.gov>
  • Loading branch information
lpottier committed Oct 19, 2024
1 parent f3bed85 commit 3ce5984
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 17 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -482,20 +482,20 @@ jobs:
\"domain_models\": {}
}""" > $GITHUB_WORKSPACE/build/tests/AMSlib/rmq.json
echo """{
\"rabbitmq-name\": \"rabbit\",
\"rabbitmq-user\": \"${RABBITMQ_USER}\",
\"rabbitmq-password\": \"${RABBITMQ_PASS}\",
\"service-port\": ${RABBITMQ_PORT},
\"service-host\": \"${RABBITMQ_HOST}\",
\"rabbitmq-vhost\": \"/\",
\"rabbitmq-outbound-queue\": \"test-ci\",
\"rabbitmq-exchange\": \"ams-fanout\",
\"rabbitmq-routing-key\": \"training\"
}""" > $GITHUB_WORKSPACE/rmq.json
# echo """{
# \"rabbitmq-name\": \"rabbit\",
# \"rabbitmq-user\": \"${RABBITMQ_USER}\",
# \"rabbitmq-password\": \"${RABBITMQ_PASS}\",
# \"service-port\": ${RABBITMQ_PORT},
# \"service-host\": \"${RABBITMQ_HOST}\",
# \"rabbitmq-vhost\": \"/\",
# \"rabbitmq-outbound-queue\": \"test-ci\",
# \"rabbitmq-exchange\": \"ams-fanout\",
# \"rabbitmq-routing-key\": \"training\"
# }""" > $GITHUB_WORKSPACE/rmq.json
python3 $GITHUB_WORKSPACE/tools/rmq/send_ams.py -c $GITHUB_WORKSPACE/rmq.json -r test3 -n 10
python3 $GITHUB_WORKSPACE/tools/rmq/recv_binary.py -c $GITHUB_WORKSPACE/rmq.json -q test3 -n 10
# python3 $GITHUB_WORKSPACE/tools/rmq/send_ams.py -c $GITHUB_WORKSPACE/rmq.json -r test3 -n 10
# python3 $GITHUB_WORKSPACE/tools/rmq/recv_binary.py -c $GITHUB_WORKSPACE/rmq.json -q test3 -n 10
# #> $GITHUB_WORKSPACE/output.txt 2>&1 || $GITHUB_WORKSPACE/output.txt
AMS_LOG_LEVEL=debug AMS_OBJECTS=$GITHUB_WORKSPACE/build/tests/AMSlib/rmq.json $GITHUB_WORKSPACE/build/tests/AMSlib/ams_rmq 0 8 9 "double" 2 1024
Expand Down
10 changes: 6 additions & 4 deletions src/AMSlib/wf/rmqdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ bool RMQHandler::onSecuring(AMQP::TcpConnection* connection, SSL* ssl)
{
// No TLS certificate provided
if (_cacert.empty()) {
CFATAL(RMQHandler, false, "No TLS certificate. Bypassing.")
DBG(RMQHandler, false, "No TLS certificate. Bypassing.")
return true;
}

Expand Down Expand Up @@ -303,7 +303,6 @@ void RMQHandler::onClosed(AMQP::TcpConnection* connection)

void RMQHandler::onError(AMQP::TcpConnection* connection, const char* message)
{
CFATAL(RMQHandler, false, "In onError %s", message)
WARNING(RMQHandler, "[r%d] fatal error on TCP connection: %s", _rId, message)
try {
error_connection.set_value(ERROR);
Expand All @@ -325,7 +324,6 @@ bool RMQHandler::waitFuture(std::future<RMQConnectionStatus>& future,
std::chrono::milliseconds span(ms);
int iters = 0;
std::future_status status;
CFATAL(RMQHandler, false, "in waitFuture")

while ((status = future.wait_for(span)) == std::future_status::timeout &&
(iters++ < repeat))
Expand Down Expand Up @@ -952,11 +950,15 @@ bool RMQInterface::connect(std::string rmq_name,
_rId = static_cast<uint64_t>(distrib(generator));

AMQP::Login login(rmq_user, rmq_password);
bool is_secure = true;
// No TLS certificate provided
if (_cacert.empty()) is_secure = false;

_address = std::make_shared<AMQP::Address>(service_host,
service_port,
login,
rmq_vhost,
/*is_secure*/ true);
is_secure);
_publisher =
std::make_shared<RMQPublisher>(_rId, *_address, _cacert, _queue_sender);

Expand Down

0 comments on commit 3ce5984

Please sign in to comment.