mirror of
https://github.com/SChernykh/p2pool.git
synced 2024-08-20 05:28:47 -06:00
ZMQReader: keep trying to connect on startup
This commit is contained in:
parent
9885f82e9e
commit
966b499e5c
@ -76,20 +76,22 @@ ZMQReader::~ZMQReader()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ZMQReader::run_wrapper(void* arg)
|
||||||
|
{
|
||||||
|
reinterpret_cast<ZMQReader*>(arg)->run();
|
||||||
|
LOGINFO(1, "worker thread stopped");
|
||||||
|
}
|
||||||
|
|
||||||
void ZMQReader::run()
|
void ZMQReader::run()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
char addr[32];
|
char addr[32];
|
||||||
|
|
||||||
snprintf(addr, sizeof(addr), "tcp://%s:%u", m_address, m_zmqPort);
|
snprintf(addr, sizeof(addr), "tcp://%s:%u", m_address, m_zmqPort);
|
||||||
if (!connect(addr, m_zmqPort)) {
|
while (!connect(addr, m_zmqPort)) { if (m_finished.load()) return; }
|
||||||
throw zmq::error_t();
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(addr, sizeof(addr), "tcp://127.0.0.1:%u", m_publisherPort);
|
snprintf(addr, sizeof(addr), "tcp://127.0.0.1:%u", m_publisherPort);
|
||||||
if (!connect(addr, m_publisherPort)) {
|
while (!connect(addr, m_publisherPort)) { if (m_finished.load()) return; }
|
||||||
throw zmq::error_t();
|
|
||||||
}
|
|
||||||
|
|
||||||
m_subscriber.set(zmq::sockopt::subscribe, "json-full-chain_main");
|
m_subscriber.set(zmq::sockopt::subscribe, "json-full-chain_main");
|
||||||
m_subscriber.set(zmq::sockopt::subscribe, "json-full-miner_data");
|
m_subscriber.set(zmq::sockopt::subscribe, "json-full-miner_data");
|
||||||
@ -122,7 +124,6 @@ void ZMQReader::run()
|
|||||||
LOGERR(1, "exception " << e.what() << ", aborting");
|
LOGERR(1, "exception " << e.what() << ", aborting");
|
||||||
panic();
|
panic();
|
||||||
}
|
}
|
||||||
LOGINFO(1, "worker thread stopped");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ZMQReader::connect(const char* address, uint32_t id)
|
bool ZMQReader::connect(const char* address, uint32_t id)
|
||||||
|
@ -28,7 +28,7 @@ public:
|
|||||||
~ZMQReader();
|
~ZMQReader();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void run_wrapper(void* arg) { reinterpret_cast<ZMQReader*>(arg)->run(); }
|
static void run_wrapper(void* arg);
|
||||||
void run();
|
void run();
|
||||||
bool connect(const char* address, uint32_t id);
|
bool connect(const char* address, uint32_t id);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user