Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3389274
D4767.id15817.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D4767.id15817.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D4767: [services] Tunnelbroker - Add AMQP shared channel locking
Attached
Detach File
Event Timeline
Log In to Comment