diff --git a/Userland/Libraries/LibCore/Socket.cpp b/Userland/Libraries/LibCore/Socket.cpp index b21c487041..6d263de7ee 100644 --- a/Userland/Libraries/LibCore/Socket.cpp +++ b/Userland/Libraries/LibCore/Socket.cpp @@ -218,6 +218,14 @@ bool Socket::close() return IODevice::close(); } +void Socket::set_idle(bool idle) +{ + if (m_read_notifier) + m_read_notifier->set_enabled(!idle); + if (m_notifier) + m_notifier->set_enabled(!idle); +} + void Socket::ensure_read_notifier() { VERIFY(m_connected); diff --git a/Userland/Libraries/LibCore/Socket.h b/Userland/Libraries/LibCore/Socket.h index 3ccbae20e2..85c1c442db 100644 --- a/Userland/Libraries/LibCore/Socket.h +++ b/Userland/Libraries/LibCore/Socket.h @@ -43,6 +43,7 @@ public: int destination_port() const { return m_destination_port; } virtual bool close() override; + virtual void set_idle(bool); Function on_connected; Function on_error;