Page MenuHomePhabricator

D4767.id15400.diff
No OneTemporary

D4767.id15400.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::unique_ptr<AMQP::TcpChannel> amqpChannel;
std::atomic<bool> amqpReady;
std::atomic<int64_t> lastConnectionTimestamp;
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
@@ -131,6 +131,8 @@
// Set delivery mode to: Durable (2)
env.setDeliveryMode(2);
env.setHeaders(std::move(headers));
+
+ std::scoped_lock(this->channelMutex);
this->amqpChannel->publish(
config::ConfigManager::getInstance().getParameter(
config::ConfigManager::OPTION_AMQP_FANOUT_EXCHANGE),
@@ -145,6 +147,7 @@
void AmqpManager::ack(uint64_t deliveryTag) {
waitUntilReady();
+ std::scoped_lock(this->channelMutex);
this->amqpChannel->ack(deliveryTag);
}

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 27, 7:55 PM (7 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2719116
Default Alt Text
D4767.id15400.diff (1 KB)

Event Timeline