mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +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
|
@ -120,16 +120,6 @@ bool IPv4Socket::can_read(FileDescription& description) const
|
|||
return m_can_read;
|
||||
}
|
||||
|
||||
ssize_t IPv4Socket::read(FileDescription& description, u8* buffer, ssize_t size)
|
||||
{
|
||||
return recvfrom(description, buffer, size, 0, nullptr, 0);
|
||||
}
|
||||
|
||||
ssize_t IPv4Socket::write(FileDescription& description, const u8* data, ssize_t size)
|
||||
{
|
||||
return sendto(description, data, size, 0, nullptr, 0);
|
||||
}
|
||||
|
||||
bool IPv4Socket::can_write(FileDescription&) const
|
||||
{
|
||||
return is_connected();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue