mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
synced 2025-10-31 18:47:47 +00:00
fix ICMP tests
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Filter Include="NetCore">
|
<Filter Include="NetCore">
|
||||||
<UniqueIdentifier>{c94a716b-53e1-4386-9dd9-c34b92252f38}</UniqueIdentifier>
|
<UniqueIdentifier>{c94a716b-53e1-4386-9dd9-c34b92252f38}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="NetCore\Header Files">
|
<Filter Include="NetCore\Header Files">
|
||||||
<UniqueIdentifier>{c19f980f-ac2d-438a-bd97-e0b5e5fa3fab}</UniqueIdentifier>
|
<UniqueIdentifier>{c19f980f-ac2d-438a-bd97-e0b5e5fa3fab}</UniqueIdentifier>
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ Poco::UInt16 ICMPSocket::mtu(const SocketAddress& address, Poco::UInt16 sz)
|
|||||||
{
|
{
|
||||||
if (address.family() != IPAddress::IPv4) return 0;
|
if (address.family() != IPAddress::IPv4) return 0;
|
||||||
|
|
||||||
SocketAddress returnAddress;
|
SocketAddress returnAddress(address);
|
||||||
for (; sz >= 68 /*RFC791*/; --sz)
|
for (; sz >= 68 /*RFC791*/; --sz)
|
||||||
{
|
{
|
||||||
ICMPSocket icmpSocket(address.family(), sz);
|
ICMPSocket icmpSocket(address.family(), sz);
|
||||||
|
|||||||
@@ -68,12 +68,12 @@ int ICMPSocketImpl::receiveFrom(void*, int, SocketAddress& address, int flags)
|
|||||||
if (ts.isElapsed(_timeout)) throw TimeoutException();
|
if (ts.isElapsed(_timeout)) throw TimeoutException();
|
||||||
buffer.clear();
|
buffer.clear();
|
||||||
SocketAddress respAddr;
|
SocketAddress respAddr;
|
||||||
rc = SocketImpl::receiveFrom(buffer.begin(), expected, respAddr, flags);
|
rc = SocketImpl::receiveFrom(buffer.begin(), maxPacketSize, respAddr, flags);
|
||||||
if (rc == 0) break;
|
if (rc == 0) break;
|
||||||
if (respAddr == address)
|
if (respAddr == address)
|
||||||
{
|
{
|
||||||
expected -= rc;
|
expected -= rc;
|
||||||
if (expected == 0)
|
if (expected <= 0)
|
||||||
{
|
{
|
||||||
if (_icmpPacket.validReplyID(buffer.begin(), maxPacketSize)) break;
|
if (_icmpPacket.validReplyID(buffer.begin(), maxPacketSize)) break;
|
||||||
int type = 0, code = 0;
|
int type = 0, code = 0;
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ SocketBuf Socket::makeBuffer(void* buffer, std::size_t length)
|
|||||||
SocketBuf ret;
|
SocketBuf ret;
|
||||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||||
ret.buf = reinterpret_cast<char*>(buffer);
|
ret.buf = reinterpret_cast<char*>(buffer);
|
||||||
ret.len = length;
|
ret.len = static_cast<ULONG>(length);
|
||||||
#elif defined(POCO_OS_FAMILY_UNIX)
|
#elif defined(POCO_OS_FAMILY_UNIX)
|
||||||
ret.iov_base = buffer;
|
ret.iov_base = buffer;
|
||||||
ret.iov_len = length;
|
ret.iov_len = length;
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ int SocketImpl::receiveBytes(Poco::Buffer<char>& buffer, int flags, const Poco::
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (_sockfd == POCO_INVALID_SOCKET) throw InvalidSocketException();
|
if (_sockfd == POCO_INVALID_SOCKET) throw InvalidSocketException();
|
||||||
rc = ::recv(_sockfd, buffer.begin(), buffer.size(), flags);
|
rc = ::recv(_sockfd, buffer.begin(), static_cast<int>(buffer.size()), flags);
|
||||||
}
|
}
|
||||||
while (_blocking && rc < 0 && lastError() == POCO_EINTR);
|
while (_blocking && rc < 0 && lastError() == POCO_EINTR);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ void ICMPSocketTest::testAssign()
|
|||||||
ICMPSocket s2(s1);
|
ICMPSocket s2(s1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ICMPSocketTest::testSendToReceiveFrom()
|
void ICMPSocketTest::testSendToReceiveFrom()
|
||||||
{
|
{
|
||||||
ICMPSocket ss(IPAddress::IPv4);
|
ICMPSocket ss(IPAddress::IPv4);
|
||||||
@@ -64,12 +65,9 @@ void ICMPSocketTest::testSendToReceiveFrom()
|
|||||||
ss.receiveFrom(sa);
|
ss.receiveFrom(sa);
|
||||||
fail("must throw");
|
fail("must throw");
|
||||||
}
|
}
|
||||||
catch(ICMPException&)
|
catch (ICMPException&) { }
|
||||||
{
|
catch (TimeoutException&) { }
|
||||||
}
|
catch (Exception&) { }
|
||||||
catch(TimeoutException&)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ss.sendTo(sa);
|
ss.sendTo(sa);
|
||||||
ss.receiveFrom(sa);
|
ss.receiveFrom(sa);
|
||||||
|
|||||||
2
openssl
2
openssl
Submodule openssl updated: 0c6d16ec85...26b1673caa
Reference in New Issue
Block a user