internet: add NotifyConnection[Succeeded,Failed] to Ipv[4,6]RawScocket

This commit is contained in:
Tommaso Pecorella
2022-10-05 01:35:35 +02:00
committed by Stefano Avallone
parent eaa62db26f
commit 30bade8812
2 changed files with 4 additions and 0 deletions

View File

@@ -178,11 +178,13 @@ Ipv4RawSocketImpl::Connect (const Address &address)
if (!InetSocketAddress::IsMatchingType (address))
{
m_err = Socket::ERROR_INVAL;
NotifyConnectionFailed ();
return -1;
}
InetSocketAddress ad = InetSocketAddress::ConvertFrom (address);
m_dst = ad.GetIpv4 ();
SetIpTos (ad.GetTos ());
NotifyConnectionSucceeded ();
return 0;
}

View File

@@ -184,10 +184,12 @@ int Ipv6RawSocketImpl::Connect (const Address& address)
if (!Inet6SocketAddress::IsMatchingType (address))
{
m_err = Socket::ERROR_INVAL;
NotifyConnectionFailed ();
return -1;
}
Inet6SocketAddress ad = Inet6SocketAddress::ConvertFrom (address);
m_dst = ad.GetIpv6 ();
NotifyConnectionSucceeded ();
return 0;
}