Verified Commit c5aefb07 authored by Tom Zander's avatar Tom Zander

Various small fixes in indexer-cli

parent e1926817
Pipeline #65074602 passed with stages
in 25 minutes and 47 seconds
......@@ -70,8 +70,8 @@ void IndexerClient::tryConnectIndexer(const EndPoint &ep)
throw std::runtime_error("Invalid Endpoint, can't create connection");
#ifndef NDEBUG
m_indexConnection.setOnConnected(std::bind(&IndexerClient::indexerConnected, this, std::placeholders::_1));
m_indexConnection.setOnDisconnected(std::bind(&IndexerClient::indexerDisconnected, this));
#endif
m_indexConnection.setOnDisconnected(std::bind(&IndexerClient::indexerDisconnected, this));
m_indexConnection.setOnIncomingMessage(std::bind(&IndexerClient::onIncomingIndexerMessage, this, std::placeholders::_1));
m_indexConnection.connect();
}
......@@ -185,7 +185,15 @@ void IndexerClient::onIncomingIndexerMessage(const Message &message)
QCoreApplication::quit();
m_txIdsRequested = usageId;
}
else
else if (message.messageId() == Api::Indexer::GetAvailableIndexersReply) {
Streaming::MessageParser parser(message);
while (parser.next() == Streaming::FoundTag) {
if (parser.tag() == Api::Indexer::AddressIndexer)
logCritical() << "Info: remote indexer has Address Index";
else if (parser.tag() == Api::Indexer::TxIdIndexer)
logCritical() << "Info: remote indexer has TXID Index";
}
} else
Streaming::MessageParser::debugMessage(message);
}
else if (message.serviceId() == Api::BlockChainService && message.messageId() == Api::BlockChain::GetTransactionReply) {
......
......@@ -42,15 +42,8 @@ int main(int argc, char **argv)
auto args = parser.positionalArguments();
if (args.isEmpty())
parser.showHelp(1);
if (args.size() == 1) // nothing to lookup
return 0;
IndexerClient client;
client.tryConnectIndexer(app.serverAddressFromArguments(1234));
for (auto a : args.mid(1)) {
client.resolve(a);
}
if (parser.isSet(hub)) {
EndPoint ep;
int port = 1235;
......@@ -58,5 +51,10 @@ int main(int argc, char **argv)
ep.announcePort = port;
client.tryConnectHub(ep);
}
client.tryConnectIndexer(app.serverAddressFromArguments(1234));
for (auto a : args) {
client.resolve(a);
}
return app.exec();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment