Page MenuHomePhabricator

D4767.id15817.diff
No OneTemporary

D4767.id15817.diff

diff --git a/services/tunnelbroker/src/Amqp/AmqpManager.h b/services/tunnelbroker/src/Amqp/AmqpManager.h
--- a/services/tunnelbroker/src/Amqp/AmqpManager.h
+++ b/services/tunnelbroker/src/Amqp/AmqpManager.h
@@ -7,6 +7,7 @@
#include <atomic>
#include <memory>
+#include <mutex>
#include <string>
namespace comm {
@@ -15,6 +16,7 @@
class AmqpManager {
AmqpManager(){};
+ std::mutex channelMutex;
std::once_flag initOnceFlag;
std::unique_ptr<AMQP::TcpChannel> amqpChannel;
std::atomic<bool> amqpReady;
diff --git a/services/tunnelbroker/src/Amqp/AmqpManager.cpp b/services/tunnelbroker/src/Amqp/AmqpManager.cpp
--- a/services/tunnelbroker/src/Amqp/AmqpManager.cpp
+++ b/services/tunnelbroker/src/Amqp/AmqpManager.cpp
@@ -123,6 +123,8 @@
// Set delivery mode to: Durable (2)
env.setDeliveryMode(2);
env.setHeaders(std::move(headers));
+
+ std::scoped_lock lock{this->channelMutex};
this->amqpChannel->publish(
config::ConfigManager::getInstance().getParameter(
config::ConfigManager::OPTION_AMQP_FANOUT_EXCHANGE),
@@ -137,6 +139,7 @@
void AmqpManager::ack(uint64_t deliveryTag) {
waitUntilReady();
+ std::scoped_lock lock{this->channelMutex};
this->amqpChannel->ack(deliveryTag);
}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 30, 6:21 PM (19 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2601920
Default Alt Text
D4767.id15817.diff (1 KB)

Event Timeline