1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-30 19:12:12 +00:00

Kernel: Implement is_zero for RoutingDecision

This commit is contained in:
Conrad Pankoff 2019-08-29 11:18:38 +10:00 committed by Andreas Kling
parent 302d521485
commit b15a7c435f
5 changed files with 11 additions and 4 deletions

View file

@ -126,7 +126,7 @@ int TCPSocket::protocol_send(const void* data, int data_length)
void TCPSocket::send_tcp_packet(u16 flags, const void* payload, int payload_size)
{
auto routing_decision = route_to(peer_address(), local_address());
ASSERT(!!routing_decision.adapter);
ASSERT(!routing_decision.is_zero());
auto buffer = ByteBuffer::create_zeroed(sizeof(TCPPacket) + payload_size);
auto& tcp_packet = *(TCPPacket*)(buffer.pointer());
@ -242,7 +242,7 @@ KResult TCPSocket::protocol_listen()
KResult TCPSocket::protocol_connect(FileDescription& description, ShouldBlock should_block)
{
auto routing_decision = route_to(peer_address(), local_address());
if (!routing_decision.adapter || routing_decision.next_hop.is_zero())
if (routing_decision.is_zero())
return KResult(-EHOSTUNREACH);
if (!has_specific_local_address())
set_local_address(routing_decision.adapter->ipv4_address());