Compare commits

..

2 Commits

Author SHA1 Message Date
Jorge Alejandro b166cf5e60
Merge b16f97c85d into b56fc99c2c 2023-07-24 16:51:16 -04:00
Jorge Alejandro b16f97c85d Add scan-interval-ms parameter
Allow user to specify the scan interval for searching for devices.
Scanning places every interface on the machine in promiscuous mode
and currently runs once a second.  This behaviour may have undesirable
side-effects and also pollutes the kernel log.

The new parameter --scan-interval-ms <interval> will allow the user
to specify the rate at which scanning occurs.  If equal to 0, then
only a single scan is performed.
2023-07-24 16:41:31 -04:00
1 changed files with 12 additions and 24 deletions

View File

@ -407,20 +407,8 @@ int main(int argc, char** argv) {
serialFilter = argv[++i];
transform(serialFilter.begin(), serialFilter.end(), serialFilter.begin(), ::toupper);
} else if(arg == "--scan-interval-ms" && i + 1 <= argc) {
try {
scanIntervalMs = std::stoi(argv[++i]);
} catch (const std::invalid_argument& e) {
std::cerr << "Invalid input for scan-interval-ms\n";
return EX_USAGE;
} catch (const std::out_of_range& e) {
std::cerr << "Out of range input for scan-interval-ms\n";
return EX_USAGE;
}
if(scanIntervalMs < 0) {
std::cerr << "Invalid input for scan-interval-ms\n";
return EX_USAGE;
}
scanIntervalMs = std::atoi(argv[i + 1]);
i++;
} else {
usage(argv[0]);
return EX_USAGE;