diff --git a/Net/samples/HTTPFormServer/perf.bash b/Net/samples/HTTPFormServer/perf.bash new file mode 100755 index 000000000..1e2437ec0 --- /dev/null +++ b/Net/samples/HTTPFormServer/perf.bash @@ -0,0 +1,13 @@ +#!/bin/bash +bin/Linux/x86_64/HTTPFormServer & +sleep 1 +curl --noproxy '*' -s http://127.0.0.1:9980 >/dev/null +curl --noproxy '*' -s http://127.0.0.1:9980 >/dev/null + +terminated_at="$(date +%s)" +echo "Terminating HTTPFormServer" +pkill HTTPFormServer +wait + +terminated_in="$(($(date +%s) - terminated_at))" +echo "HTTPFormServer took ${terminated_in} seconds to terminate" diff --git a/Net/src/SocketImpl.cpp b/Net/src/SocketImpl.cpp index 408dca057..1e9404b3e 100644 --- a/Net/src/SocketImpl.cpp +++ b/Net/src/SocketImpl.cpp @@ -619,7 +619,7 @@ int SocketImpl::available() int result = 0; ioctl(FIONREAD, result); #if (POCO_OS != POCO_OS_LINUX) - if (type() == SOCKET_TYPE_DATAGRAM) + if (result && (type() == SOCKET_TYPE_DATAGRAM)) { std::vector buf(result); result = recvfrom(sockfd(), &buf[0], result, MSG_PEEK, NULL, NULL);