mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: TCPSocket always has a scratch buffer
Let's encode this in the constructor signature.
This commit is contained in:
parent
308773ffda
commit
c69035c630
Notes:
sideshowbarker
2024-07-18 04:31:26 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c69035c6301
2 changed files with 3 additions and 3 deletions
|
@ -130,7 +130,7 @@ void TCPSocket::release_for_accept(RefPtr<TCPSocket> socket)
|
||||||
[[maybe_unused]] auto rc = queue_connection_from(*socket);
|
[[maybe_unused]] auto rc = queue_connection_from(*socket);
|
||||||
}
|
}
|
||||||
|
|
||||||
TCPSocket::TCPSocket(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer, OwnPtr<KBuffer> scratch_buffer)
|
TCPSocket::TCPSocket(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer, NonnullOwnPtr<KBuffer> scratch_buffer)
|
||||||
: IPv4Socket(SOCK_STREAM, protocol, move(receive_buffer), move(scratch_buffer))
|
: IPv4Socket(SOCK_STREAM, protocol, move(receive_buffer), move(scratch_buffer))
|
||||||
{
|
{
|
||||||
m_last_retransmit_time = kgettimeofday();
|
m_last_retransmit_time = kgettimeofday();
|
||||||
|
@ -154,7 +154,7 @@ KResultOr<NonnullRefPtr<TCPSocket>> TCPSocket::try_create(int protocol, NonnullO
|
||||||
if (!scratch_buffer)
|
if (!scratch_buffer)
|
||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
|
|
||||||
return adopt_nonnull_ref_or_enomem(new (nothrow) TCPSocket(protocol, move(receive_buffer), move(scratch_buffer)));
|
return adopt_nonnull_ref_or_enomem(new (nothrow) TCPSocket(protocol, move(receive_buffer), scratch_buffer.release_nonnull()));
|
||||||
}
|
}
|
||||||
|
|
||||||
KResultOr<size_t> TCPSocket::protocol_receive(ReadonlyBytes raw_ipv4_packet, UserOrKernelBuffer& buffer, size_t buffer_size, [[maybe_unused]] int flags)
|
KResultOr<size_t> TCPSocket::protocol_receive(ReadonlyBytes raw_ipv4_packet, UserOrKernelBuffer& buffer, size_t buffer_size, [[maybe_unused]] int flags)
|
||||||
|
|
|
@ -165,7 +165,7 @@ protected:
|
||||||
void set_direction(Direction direction) { m_direction = direction; }
|
void set_direction(Direction direction) { m_direction = direction; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit TCPSocket(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer, OwnPtr<KBuffer> scratch_buffer);
|
explicit TCPSocket(int protocol, NonnullOwnPtr<DoubleBuffer> receive_buffer, NonnullOwnPtr<KBuffer> scratch_buffer);
|
||||||
virtual StringView class_name() const override { return "TCPSocket"; }
|
virtual StringView class_name() const override { return "TCPSocket"; }
|
||||||
|
|
||||||
virtual void shut_down_for_writing() override;
|
virtual void shut_down_for_writing() override;
|
||||||
|
|
Loading…
Reference in a new issue