diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-05 15:48:40 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-05 16:25:40 +0200 |
commit | 8714c550b41c730db23f2c65adb5392f3fe7553e (patch) | |
tree | 0276fe2db01b95ff0446c2a87675c02d2a998e2e /Kernel | |
parent | 2a57cb19af0d7ad2b25a9d8b7205ee4931444cb8 (diff) | |
download | serenity-8714c550b41c730db23f2c65adb5392f3fe7553e.zip |
Kernel: Use TRY() in TCPSocket
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Net/TCPSocket.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Kernel/Net/TCPSocket.cpp b/Kernel/Net/TCPSocket.cpp index dc50642fd1..740696ef6a 100644 --- a/Kernel/Net/TCPSocket.cpp +++ b/Kernel/Net/TCPSocket.cpp @@ -181,8 +181,7 @@ KResultOr<size_t> TCPSocket::protocol_send(const UserOrKernelBuffer& data, size_ return set_so_error(EHOSTUNREACH); size_t mss = routing_decision.adapter->mtu() - sizeof(IPv4Packet) - sizeof(TCPPacket); data_length = min(data_length, mss); - if (auto result = send_tcp_packet(TCPFlags::PUSH | TCPFlags::ACK, &data, data_length, &routing_decision); result.is_error()) - return result; + TRY(send_tcp_packet(TCPFlags::PUSH | TCPFlags::ACK, &data, data_length, &routing_decision)); return data_length; } @@ -410,8 +409,7 @@ KResult TCPSocket::protocol_connect(FileDescription& description, ShouldBlock sh m_ack_number = 0; set_setup_state(SetupState::InProgress); - if (auto result = send_tcp_packet(TCPFlags::SYN); result.is_error()) - return result; + TRY(send_tcp_packet(TCPFlags::SYN)); m_state = State::SynSent; set_role(Role::Connecting); m_direction = Direction::Outgoing; |