summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-02-08 15:59:21 +0100
committerAndreas Kling <kling@serenityos.org>2020-02-08 16:04:31 +0100
commit3891e6d7397ed1cebca5e4675307874ef75286ce (patch)
treef0f9587e4a3db8d6959ce8b30e16ff9581b30ad9
parent228a1e90998fb0f729e6fe9fa3057fe15b203088 (diff)
downloadserenity-3891e6d7397ed1cebca5e4675307874ef75286ce.zip
IPv4: Sockets should say can_read() after reading is shut down
This allows clients to get their EOF after shutting down reading.
-rw-r--r--Kernel/Net/IPv4Socket.cpp6
-rw-r--r--Kernel/Net/IPv4Socket.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/Kernel/Net/IPv4Socket.cpp b/Kernel/Net/IPv4Socket.cpp
index 35c8c472b0..7d427941b6 100644
--- a/Kernel/Net/IPv4Socket.cpp
+++ b/Kernel/Net/IPv4Socket.cpp
@@ -505,3 +505,9 @@ void IPv4Socket::close()
{
shutdown(SHUT_RDWR);
}
+
+void IPv4Socket::shut_down_for_reading()
+{
+ Socket::shut_down_for_reading();
+ m_can_read = true;
+}
diff --git a/Kernel/Net/IPv4Socket.h b/Kernel/Net/IPv4Socket.h
index ebf09c38ae..96650fdea2 100644
--- a/Kernel/Net/IPv4Socket.h
+++ b/Kernel/Net/IPv4Socket.h
@@ -100,6 +100,8 @@ protected:
virtual int protocol_allocate_local_port() { return 0; }
virtual bool protocol_is_disconnected() const { return false; }
+ virtual void shut_down_for_reading() override;
+
void set_local_address(IPv4Address address) { m_local_address = address; }
void set_peer_address(IPv4Address address) { m_peer_address = address; }