mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:27:35 +00:00
Kernel: Make KBuffer a value-type wrapper around a KBufferImpl
A KBuffer always contains a valid KBufferImpl. If you need a "null" state buffer, use Optional<KBuffer>. This makes KBuffer very easy to work with and pass around, just like ByteBuffer before it.
This commit is contained in:
parent
52cfe9ebae
commit
605975adb5
6 changed files with 50 additions and 22 deletions
|
@ -32,7 +32,7 @@ public:
|
|||
virtual ssize_t sendto(FileDescription&, const void*, size_t, int, const sockaddr*, socklen_t) override;
|
||||
virtual ssize_t recvfrom(FileDescription&, void*, size_t, int flags, sockaddr*, socklen_t*) override;
|
||||
|
||||
void did_receive(const IPv4Address& peer_address, u16 peer_port, NonnullRefPtr<KBuffer>&&);
|
||||
void did_receive(const IPv4Address& peer_address, u16 peer_port, KBuffer&&);
|
||||
|
||||
const IPv4Address& local_address() const;
|
||||
u16 local_port() const { return m_local_port; }
|
||||
|
@ -64,7 +64,7 @@ private:
|
|||
struct ReceivedPacket {
|
||||
IPv4Address peer_address;
|
||||
u16 peer_port;
|
||||
RefPtr<KBuffer> data;
|
||||
Optional<KBuffer> data;
|
||||
};
|
||||
|
||||
SinglyLinkedList<ReceivedPacket> m_receive_queue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue