mirror of
https://github.com/SChernykh/p2pool.git
synced 2025-01-09 20:30:05 +00:00
Fixed a leak in ZMQReader
This commit is contained in:
parent
776b1f561c
commit
2761ce5af7
1 changed files with 8 additions and 6 deletions
|
@ -93,15 +93,15 @@ void ZMQReader::run()
|
||||||
m_subscriber.set(zmq::sockopt::subscribe, "json-full-miner_data");
|
m_subscriber.set(zmq::sockopt::subscribe, "json-full-miner_data");
|
||||||
m_subscriber.set(zmq::sockopt::subscribe, "json-minimal-txpool_add");
|
m_subscriber.set(zmq::sockopt::subscribe, "json-minimal-txpool_add");
|
||||||
|
|
||||||
LOGINFO(1, "worker thread ready");
|
|
||||||
|
|
||||||
do {
|
|
||||||
zmq_msg_t message;
|
zmq_msg_t message;
|
||||||
int rc = zmq_msg_init(&message);
|
int rc = zmq_msg_init(&message);
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
throw zmq::error_t();
|
throw zmq::error_t();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LOGINFO(1, "worker thread ready");
|
||||||
|
|
||||||
|
do {
|
||||||
rc = zmq_msg_recv(&message, m_subscriber, 0);
|
rc = zmq_msg_recv(&message, m_subscriber, 0);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
throw zmq::error_t();
|
throw zmq::error_t();
|
||||||
|
@ -113,6 +113,8 @@ void ZMQReader::run()
|
||||||
|
|
||||||
parse(reinterpret_cast<char*>(zmq_msg_data(&message)), zmq_msg_size(&message));
|
parse(reinterpret_cast<char*>(zmq_msg_data(&message)), zmq_msg_size(&message));
|
||||||
} while (true);
|
} while (true);
|
||||||
|
|
||||||
|
zmq_msg_close(&message);
|
||||||
}
|
}
|
||||||
catch (const std::exception& e) {
|
catch (const std::exception& e) {
|
||||||
LOGERR(1, "exception " << e.what() << ", aborting");
|
LOGERR(1, "exception " << e.what() << ", aborting");
|
||||||
|
|
Loading…
Reference in a new issue