mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
synced 2025-11-01 02:57:51 +00:00
fix ICMP tests
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<?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">
|
||||
<ItemGroup>
|
||||
<Filter Include="NetCore">
|
||||
|
||||
@@ -102,7 +102,7 @@ Poco::UInt16 ICMPSocket::mtu(const SocketAddress& address, Poco::UInt16 sz)
|
||||
{
|
||||
if (address.family() != IPAddress::IPv4) return 0;
|
||||
|
||||
SocketAddress returnAddress;
|
||||
SocketAddress returnAddress(address);
|
||||
for (; sz >= 68 /*RFC791*/; --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();
|
||||
buffer.clear();
|
||||
SocketAddress respAddr;
|
||||
rc = SocketImpl::receiveFrom(buffer.begin(), expected, respAddr, flags);
|
||||
rc = SocketImpl::receiveFrom(buffer.begin(), maxPacketSize, respAddr, flags);
|
||||
if (rc == 0) break;
|
||||
if (respAddr == address)
|
||||
{
|
||||
expected -= rc;
|
||||
if (expected == 0)
|
||||
if (expected <= 0)
|
||||
{
|
||||
if (_icmpPacket.validReplyID(buffer.begin(), maxPacketSize)) break;
|
||||
int type = 0, code = 0;
|
||||
|
||||
@@ -422,7 +422,7 @@ SocketBuf Socket::makeBuffer(void* buffer, std::size_t length)
|
||||
SocketBuf ret;
|
||||
#if defined(POCO_OS_FAMILY_WINDOWS)
|
||||
ret.buf = reinterpret_cast<char*>(buffer);
|
||||
ret.len = length;
|
||||
ret.len = static_cast<ULONG>(length);
|
||||
#elif defined(POCO_OS_FAMILY_UNIX)
|
||||
ret.iov_base = buffer;
|
||||
ret.iov_len = length;
|
||||
|
||||
@@ -431,7 +431,7 @@ int SocketImpl::receiveBytes(Poco::Buffer<char>& buffer, int flags, const Poco::
|
||||
do
|
||||
{
|
||||
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);
|
||||
if (rc < 0)
|
||||
|
||||
@@ -52,6 +52,7 @@ void ICMPSocketTest::testAssign()
|
||||
ICMPSocket s2(s1);
|
||||
}
|
||||
|
||||
|
||||
void ICMPSocketTest::testSendToReceiveFrom()
|
||||
{
|
||||
ICMPSocket ss(IPAddress::IPv4);
|
||||
@@ -64,12 +65,9 @@ void ICMPSocketTest::testSendToReceiveFrom()
|
||||
ss.receiveFrom(sa);
|
||||
fail("must throw");
|
||||
}
|
||||
catch(ICMPException&)
|
||||
{
|
||||
}
|
||||
catch(TimeoutException&)
|
||||
{
|
||||
}
|
||||
catch (ICMPException&) { }
|
||||
catch (TimeoutException&) { }
|
||||
catch (Exception&) { }
|
||||
|
||||
ss.sendTo(sa);
|
||||
ss.receiveFrom(sa);
|
||||
|
||||
2
openssl
2
openssl
Submodule openssl updated: 0c6d16ec85...26b1673caa
Reference in New Issue
Block a user