diff options
author | asynts <asynts@gmail.com> | 2020-07-27 15:00:12 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-27 19:58:09 +0200 |
commit | 21de20825a58c2cd314c19eddf071560a60aff99 (patch) | |
tree | 73cc4f7870854a10f09626601d80f91ff383b660 /Libraries/LibCore | |
parent | 4709b700bd91c181c9bfa157ad720036f7717b5a (diff) | |
download | serenity-21de20825a58c2cd314c19eddf071560a60aff99.zip |
LibCore: Change the signature of Socket::send() to use Span.
Diffstat (limited to 'Libraries/LibCore')
-rw-r--r-- | Libraries/LibCore/Socket.cpp | 6 | ||||
-rw-r--r-- | Libraries/LibCore/Socket.h | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/Libraries/LibCore/Socket.cpp b/Libraries/LibCore/Socket.cpp index c8f07672f2..a12c57993a 100644 --- a/Libraries/LibCore/Socket.cpp +++ b/Libraries/LibCore/Socket.cpp @@ -167,7 +167,7 @@ ByteBuffer Socket::receive(int max_size) return buffer; } -bool Socket::send(const ByteBuffer& data) +bool Socket::send(ReadonlyBytes data) { ssize_t nsent = ::send(fd(), data.data(), data.size(), 0); if (nsent < 0) { @@ -182,8 +182,8 @@ void Socket::did_update_fd(int fd) { if (fd < 0) { if (m_read_notifier) { - m_read_notifier->remove_from_parent(); - m_read_notifier = nullptr; + m_read_notifier->remove_from_parent(); + m_read_notifier = nullptr; } if (m_notifier) { m_notifier->remove_from_parent(); diff --git a/Libraries/LibCore/Socket.h b/Libraries/LibCore/Socket.h index e6803fbb40..fcbd2af31d 100644 --- a/Libraries/LibCore/Socket.h +++ b/Libraries/LibCore/Socket.h @@ -27,6 +27,7 @@ #pragma once #include <AK/Function.h> +#include <AK/Span.h> #include <LibCore/IODevice.h> #include <LibCore/SocketAddress.h> @@ -50,7 +51,7 @@ public: bool connect(const SocketAddress&); ByteBuffer receive(int max_size); - bool send(const ByteBuffer&); + bool send(ReadonlyBytes); bool is_connected() const { return m_connected; } void set_blocking(bool blocking); |