mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:07:34 +00:00
Net: Let Socket have read/write wrappers around sendto/recvfrom
The situations in IPv4Socket and LocalSocket were mirrors of each other where one had implemented read/write as wrappers and the other had sendto/recvfrom as wrappers. Instead of this silliness, move read and write up to the Socket base. Then mark them final, so subclasses have no choice but to implement sendto and recvfrom.
This commit is contained in:
parent
9111d3626a
commit
6347e3aa51
6 changed files with 37 additions and 47 deletions
|
@ -10,6 +10,7 @@ public:
|
|||
static NonnullRefPtr<LocalSocket> create(int type);
|
||||
virtual ~LocalSocket() override;
|
||||
|
||||
// ^Socket
|
||||
virtual KResult bind(const sockaddr*, socklen_t) override;
|
||||
virtual KResult connect(FileDescription&, const sockaddr*, socklen_t, ShouldBlock = ShouldBlock::Yes) override;
|
||||
virtual bool get_local_address(sockaddr*, socklen_t*) override;
|
||||
|
@ -17,8 +18,6 @@ public:
|
|||
virtual void attach(FileDescription&) override;
|
||||
virtual void detach(FileDescription&) override;
|
||||
virtual bool can_read(FileDescription&) const override;
|
||||
virtual ssize_t read(FileDescription&, u8*, ssize_t) override;
|
||||
virtual ssize_t write(FileDescription&, const u8*, ssize_t) override;
|
||||
virtual bool can_write(FileDescription&) const override;
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue