when trying to flush the send buffer, use select to wait until it is possible instead of using sleep to retry at a given frequency

This commit is contained in:
Benjamin Sergeant
2019-03-18 14:25:27 -07:00
parent e98634a277
commit d58798e36c
11 changed files with 126 additions and 53 deletions

View File

@ -44,13 +44,17 @@ int main(int argc, char** argv)
int connectTimeOut = 60;
int transferTimeout = 1800;
int maxRedirects = 5;
int delayMs = -1;
CLI::App* sendApp = app.add_subcommand("send", "Send a file");
sendApp->add_option("url", url, "Connection url")->required();
sendApp->add_option("path", path, "Path to the file to send")
->required()->check(CLI::ExistingPath);
CLI::App* receiveApp = app.add_subcommand("receive", "Receive a file");
receiveApp->add_option("url", url, "Connection url")->required();
receiveApp->add_option("--delay", delayMs, "Delay (ms) to wait after receiving a fragment"
" to artificially slow down the receiver");
CLI::App* transferApp = app.add_subcommand("transfer", "Broadcasting server");
transferApp->add_option("--port", port, "Connection url");
@ -114,7 +118,7 @@ int main(int argc, char** argv)
else if (app.got_subcommand("receive"))
{
bool enablePerMessageDeflate = false;
return ix::ws_receive_main(url, enablePerMessageDeflate);
return ix::ws_receive_main(url, enablePerMessageDeflate, delayMs);
}
else if (app.got_subcommand("connect"))
{