mirror of
https://github.com/pocoproject/poco.git
synced 2025-03-30 07:26:33 +02:00
fix(SocketImpl): available() #3834
This commit is contained in:
parent
2effb38396
commit
1319d3f7ef
13
Net/samples/HTTPFormServer/perf.bash
Executable file
13
Net/samples/HTTPFormServer/perf.bash
Executable file
@ -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"
|
@ -619,7 +619,7 @@ int SocketImpl::available()
|
|||||||
int result = 0;
|
int result = 0;
|
||||||
ioctl(FIONREAD, result);
|
ioctl(FIONREAD, result);
|
||||||
#if (POCO_OS != POCO_OS_LINUX)
|
#if (POCO_OS != POCO_OS_LINUX)
|
||||||
if (type() == SOCKET_TYPE_DATAGRAM)
|
if (result && (type() == SOCKET_TYPE_DATAGRAM))
|
||||||
{
|
{
|
||||||
std::vector<char> buf(result);
|
std::vector<char> buf(result);
|
||||||
result = recvfrom(sockfd(), &buf[0], result, MSG_PEEK, NULL, NULL);
|
result = recvfrom(sockfd(), &buf[0], result, MSG_PEEK, NULL, NULL);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user