Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3552330
D4767.id15400.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.id15400.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::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
Details
Attached
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)
Attached To
Mode
D4767: [services] Tunnelbroker - Add AMQP shared channel locking
Attached
Detach File
Event Timeline
Log In to Comment