summaryrefslogtreecommitdiff
path: root/Libraries/LibCore/CSocket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibCore/CSocket.cpp')
-rw-r--r--Libraries/LibCore/CSocket.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/Libraries/LibCore/CSocket.cpp b/Libraries/LibCore/CSocket.cpp
index c49a6e2698..636dc179d5 100644
--- a/Libraries/LibCore/CSocket.cpp
+++ b/Libraries/LibCore/CSocket.cpp
@@ -137,3 +137,16 @@ bool CSocket::listen()
set_error(errno);
return rc == 0;
}
+
+void CSocket::did_update_fd(int fd)
+{
+ if (fd < 0) {
+ m_read_notifier = nullptr;
+ return;
+ }
+ m_read_notifier = make<CNotifier>(fd, CNotifier::Event::Read);
+ m_read_notifier->on_ready_to_read = [this] {
+ if (on_ready_to_read)
+ on_ready_to_read();
+ };
+}