workaround bug in Socket::isReadyToWrite
This commit is contained in:
parent
eb6ee52aaa
commit
bbc0e2106c
@ -211,7 +211,8 @@ namespace ix
|
|||||||
setReadyState(CLOSED);
|
setReadyState(CLOSED);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (result == PollResultType_ReadyForWrite)
|
// FIXME: why are we not getting PollResultType_ReadyForWrite ??
|
||||||
|
else // if (result == PollResultType_ReadyForWrite)
|
||||||
{
|
{
|
||||||
sendOnSocket();
|
sendOnSocket();
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ mkdir -p /tmp/ws_test
|
|||||||
|
|
||||||
# Start a transport server
|
# Start a transport server
|
||||||
cd /tmp/ws_test
|
cd /tmp/ws_test
|
||||||
ws transfer --port 8090 --pidfile /tmp/ws_test/pidfile &
|
ws transfer --port 8090 --pidfile /tmp/ws_test/pidfile.transfer &
|
||||||
|
|
||||||
# Wait until the transfer server is up
|
# Wait until the transfer server is up
|
||||||
while true
|
while true
|
||||||
@ -14,21 +14,21 @@ do
|
|||||||
echo "Transfer server up and running"
|
echo "Transfer server up and running"
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
echo "sleep ..."
|
echo "sleep ... wait for transfer server"
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
done
|
done
|
||||||
|
|
||||||
# Start a receiver
|
# Start a receiver
|
||||||
mkdir -p /tmp/ws_test/receive
|
mkdir -p /tmp/ws_test/receive
|
||||||
cd /tmp/ws_test/receive
|
cd /tmp/ws_test/receive
|
||||||
ws receive --delay 5 ws://127.0.0.1:8090 &
|
ws receive --delay 5 ws://127.0.0.1:8090 --pidfile /tmp/ws_test/pidfile.receive &
|
||||||
|
|
||||||
mkdir /tmp/ws_test/send
|
mkdir /tmp/ws_test/send
|
||||||
cd /tmp/ws_test/send
|
cd /tmp/ws_test/send
|
||||||
dd if=/dev/urandom of=20M_file count=20000 bs=1024
|
dd if=/dev/urandom of=20M_file count=10000 bs=1024
|
||||||
|
|
||||||
# Start the sender job
|
# Start the sender job
|
||||||
ws send ws://127.0.0.1:8090 20M_file
|
ws send --pidfile /tmp/ws_test/pidfile.send ws://127.0.0.1:8090 20M_file
|
||||||
|
|
||||||
# Wait until the file has been written to disk
|
# Wait until the file has been written to disk
|
||||||
while true
|
while true
|
||||||
@ -37,7 +37,7 @@ do
|
|||||||
echo "Received file does exists, exiting loop"
|
echo "Received file does exists, exiting loop"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
echo "sleep ..."
|
echo "sleep ... wait for output file"
|
||||||
sleep 0.1
|
sleep 0.1
|
||||||
done
|
done
|
||||||
|
|
||||||
@ -48,4 +48,7 @@ cksum /tmp/ws_test/receive/20M_file
|
|||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
kill `cat /tmp/ws_test/pidfile`
|
kill `cat /tmp/ws_test/pidfile.transfer`
|
||||||
|
kill `cat /tmp/ws_test/pidfile.receive`
|
||||||
|
kill `cat /tmp/ws_test/pidfile.send`
|
||||||
|
|
||||||
|
24
ws/ws.cpp
24
ws/ws.cpp
@ -50,11 +50,13 @@ int main(int argc, char** argv)
|
|||||||
sendApp->add_option("url", url, "Connection url")->required();
|
sendApp->add_option("url", url, "Connection url")->required();
|
||||||
sendApp->add_option("path", path, "Path to the file to send")
|
sendApp->add_option("path", path, "Path to the file to send")
|
||||||
->required()->check(CLI::ExistingPath);
|
->required()->check(CLI::ExistingPath);
|
||||||
|
sendApp->add_option("--pidfile", pidfile, "Pid file");
|
||||||
|
|
||||||
CLI::App* receiveApp = app.add_subcommand("receive", "Receive a file");
|
CLI::App* receiveApp = app.add_subcommand("receive", "Receive a file");
|
||||||
receiveApp->add_option("url", url, "Connection url")->required();
|
receiveApp->add_option("url", url, "Connection url")->required();
|
||||||
receiveApp->add_option("--delay", delayMs, "Delay (ms) to wait after receiving a fragment"
|
receiveApp->add_option("--delay", delayMs, "Delay (ms) to wait after receiving a fragment"
|
||||||
" to artificially slow down the receiver");
|
" to artificially slow down the receiver");
|
||||||
|
receiveApp->add_option("--pidfile", pidfile, "Pid file");
|
||||||
|
|
||||||
CLI::App* transferApp = app.add_subcommand("transfer", "Broadcasting server");
|
CLI::App* transferApp = app.add_subcommand("transfer", "Broadcasting server");
|
||||||
transferApp->add_option("--port", port, "Connection url");
|
transferApp->add_option("--port", port, "Connection url");
|
||||||
@ -96,19 +98,19 @@ int main(int argc, char** argv)
|
|||||||
|
|
||||||
CLI11_PARSE(app, argc, argv);
|
CLI11_PARSE(app, argc, argv);
|
||||||
|
|
||||||
|
// pid file handling
|
||||||
|
if (!pidfile.empty())
|
||||||
|
{
|
||||||
|
unlink(pidfile.c_str());
|
||||||
|
|
||||||
|
std::ofstream f;
|
||||||
|
f.open(pidfile);
|
||||||
|
f << getpid();
|
||||||
|
f.close();
|
||||||
|
}
|
||||||
|
|
||||||
if (app.got_subcommand("transfer"))
|
if (app.got_subcommand("transfer"))
|
||||||
{
|
{
|
||||||
// pid file handling
|
|
||||||
if (!pidfile.empty())
|
|
||||||
{
|
|
||||||
unlink(pidfile.c_str());
|
|
||||||
|
|
||||||
std::ofstream f;
|
|
||||||
f.open(pidfile);
|
|
||||||
f << getpid();
|
|
||||||
f.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ix::ws_transfer_main(port, hostname);
|
return ix::ws_transfer_main(port, hostname);
|
||||||
}
|
}
|
||||||
else if (app.got_subcommand("send"))
|
else if (app.got_subcommand("send"))
|
||||||
|
Loading…
Reference in New Issue
Block a user