From d3dc0698a52f4885d72c12ef1d9808828bcd6e82 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Fri, 16 Sep 2016 13:51:33 -0700 Subject: [PATCH] more command-line arguments --- tools/ice-client/src/ICEClientApp.cpp | 22 ++++++++++++++++++++-- tools/ice-client/src/ICEClientApp.h | 1 + 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/tools/ice-client/src/ICEClientApp.cpp b/tools/ice-client/src/ICEClientApp.cpp index f1629bf5e7..c1c2d047cc 100644 --- a/tools/ice-client/src/ICEClientApp.cpp +++ b/tools/ice-client/src/ICEClientApp.cpp @@ -33,6 +33,10 @@ ICEClientApp::ICEClientApp(int argc, char* argv[]) : QCoreApplication(argc, argv const QCommandLineOption howManyTimesOption("n", "how many times to cycle", "0"); parser.addOption(howManyTimesOption); + const QCommandLineOption domainIDOption("d", "domain-server uuid"); + parser.addOption(domainIDOption); + + if (!parser.parse(QCoreApplication::arguments())) { qCritical() << parser.errorText() << endl; parser.showHelp(); @@ -50,6 +54,11 @@ ICEClientApp::ICEClientApp(int argc, char* argv[]) : QCoreApplication(argc, argv _actionMax = parser.value(howManyTimesOption).toInt(); } + if (parser.isSet(domainIDOption)) { + _domainID = QUuid(parser.value(howManyTimesOption)); + } + + _iceServerAddr = HifiSockAddr("127.0.0.1", ICE_SERVER_DEFAULT_PORT); if (parser.isSet(iceServerAddressOption)) { // parse the IP and port combination for this target @@ -97,12 +106,21 @@ void ICEClientApp::doSomething() { _localSockAddr = HifiSockAddr("127.0.0.1", _socket->localPort()); _publicSockAddr = HifiSockAddr("127.0.0.1", _socket->localPort()); - QUuid peerID = QUuid("75cd162a-53dc-4292-aaa5-1304ab1bb0f2"); + // QUuid peerID = QUuid("75cd162a-53dc-4292-aaa5-1304ab1bb0f2"); + QUuid peerID; + if (_domainID == QUuid()) { + // pick a random domain-id + peerID = QUuid::createUuid(); + _state = 2; + } else { + // use the domain UUID given on the command-line + peerID = _domainID; + _state = 1; + } _sessionUUID = QUuid::createUuid(); sendPacketToIceServer(PacketType::ICEServerQuery, _iceServerAddr, _sessionUUID, peerID); - _state = 1; _actionCount++; } else if (_state == 2) { _state = 3; diff --git a/tools/ice-client/src/ICEClientApp.h b/tools/ice-client/src/ICEClientApp.h index 6728a0ed83..de40d07338 100644 --- a/tools/ice-client/src/ICEClientApp.h +++ b/tools/ice-client/src/ICEClientApp.h @@ -39,6 +39,7 @@ private: unsigned int _actionMax { 0 }; QUuid _sessionUUID; + QUuid _domainID; QTimer* _pingDomainTimer { nullptr };