mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-05 03:53:44 +02:00
add mutex to channel numbering
This commit is contained in:
parent
52c85aa605
commit
cda07b20a2
2 changed files with 10 additions and 3 deletions
|
@ -48,7 +48,10 @@ void RabbitMQ::init()
|
||||||
}
|
}
|
||||||
|
|
||||||
static int chan = 0;
|
static int chan = 0;
|
||||||
_channel = ++chan;
|
{
|
||||||
|
Mutex::Lock l(_chan_m);
|
||||||
|
_channel = ++chan;
|
||||||
|
}
|
||||||
amqp_channel_open(_conn, _channel);
|
amqp_channel_open(_conn, _channel);
|
||||||
r = amqp_get_rpc_reply(_conn);
|
r = amqp_get_rpc_reply(_conn);
|
||||||
if(r.reply_type != AMQP_RESPONSE_NORMAL) {
|
if(r.reply_type != AMQP_RESPONSE_NORMAL) {
|
||||||
|
@ -88,4 +91,4 @@ std::string RabbitMQ::consume()
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,9 +36,10 @@ struct MQConfig {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef ZT_CONTROLLER_USE_LIBPQ
|
#ifdef ZT_CONTROLLER_USE_LIBPQ
|
||||||
|
|
||||||
|
#include "../node/Mutex.hpp"
|
||||||
|
|
||||||
#include <amqp.h>
|
#include <amqp.h>
|
||||||
#include <amqp_tcp_socket.h>
|
#include <amqp_tcp_socket.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -65,6 +66,9 @@ private:
|
||||||
int _status;
|
int _status;
|
||||||
|
|
||||||
int _channel;
|
int _channel;
|
||||||
|
|
||||||
|
Mutex _chan_m;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue