mirror of
https://github.com/BotChain-Robots/rpc.git
synced 2026-07-08 17:07:21 +02:00
Reliability improvements
This commit is contained in:
@@ -31,8 +31,8 @@ class TCPClient final : public ICommunicationClient {
|
||||
public:
|
||||
TCPClient(std::string ip,
|
||||
const std::shared_ptr<BlockingQueue<std::unique_ptr<std::vector<uint8_t>>>> &rx_queue)
|
||||
: port{3001}, m_ip{std::move(ip)}, m_stop_flag(false),
|
||||
m_thread(std::thread(&TCPClient::rx_thread, this)), m_rx_queue(rx_queue) {
|
||||
: port{3001}, m_ip{std::move(ip)}, m_stop_flag(false), m_rx_queue(rx_queue) {
|
||||
m_thread = std::thread(&TCPClient::rx_thread, this);
|
||||
}
|
||||
~TCPClient() override;
|
||||
int init() override;
|
||||
|
||||
@@ -31,8 +31,8 @@ class UDPClient final : public ICommunicationClient {
|
||||
public:
|
||||
UDPClient(std::string ip,
|
||||
const std::shared_ptr<BlockingQueue<std::unique_ptr<std::vector<uint8_t>>>> &rx_queue)
|
||||
: m_stop_flag(false), m_thread(std::thread(&UDPClient::rx_thread, this)),
|
||||
m_remote_ip(std::move(ip)), m_rx_queue(rx_queue) {
|
||||
: m_stop_flag(false), m_remote_ip(std::move(ip)), m_rx_queue(rx_queue) {
|
||||
m_thread = std::thread(&UDPClient::rx_thread, this);
|
||||
}
|
||||
~UDPClient() override;
|
||||
int init() override;
|
||||
|
||||
@@ -24,8 +24,7 @@ struct SizeAndSource {
|
||||
class MessagingInterface {
|
||||
public:
|
||||
MessagingInterface()
|
||||
: m_stop_flag(false), m_rx_thread(std::thread(&MessagingInterface::handle_recv, this)),
|
||||
m_fn_rx_thread(std::thread(&MessagingInterface::handle_fn_recv, this)),
|
||||
: m_stop_flag(false),
|
||||
m_rx_queue(std::make_shared<BlockingQueue<std::unique_ptr<std::vector<uint8_t>>>>(
|
||||
RX_QUEUE_SIZE)) {
|
||||
#ifdef _WIN32
|
||||
@@ -34,6 +33,8 @@ class MessagingInterface {
|
||||
#endif
|
||||
// Initialization must be after call to WSAStartup
|
||||
m_discovery_service = std::make_unique<mDNSDiscoveryService>();
|
||||
m_rx_thread = std::thread(&MessagingInterface::handle_recv, this);
|
||||
m_fn_rx_thread = std::thread(&MessagingInterface::handle_fn_recv, this);
|
||||
}
|
||||
|
||||
~MessagingInterface();
|
||||
|
||||
Reference in New Issue
Block a user