mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:17:44 +00:00
LibIPC: Only start responsiveness timer after sending client a message
Instead of always running the responsiveness timer for IPC clients, we now only start it after sending a message. This avoids waking up otherwise idle clients to do ping/pong busywork.
This commit is contained in:
parent
47df0cbbc8
commit
4ab1b0b436
3 changed files with 13 additions and 2 deletions
|
@ -101,6 +101,7 @@ public:
|
|||
}
|
||||
|
||||
virtual void may_have_become_unresponsive() {}
|
||||
virtual void did_become_responsive() {}
|
||||
|
||||
void post_message(const Message& message)
|
||||
{
|
||||
|
@ -130,6 +131,8 @@ public:
|
|||
}
|
||||
|
||||
ASSERT(static_cast<size_t>(nwritten) == buffer.size());
|
||||
|
||||
m_responsiveness_timer->start();
|
||||
}
|
||||
|
||||
void drain_messages_from_client()
|
||||
|
@ -156,8 +159,10 @@ public:
|
|||
bytes.append(buffer, nread);
|
||||
}
|
||||
|
||||
if (!bytes.is_empty())
|
||||
m_responsiveness_timer->restart();
|
||||
if (!bytes.is_empty()) {
|
||||
m_responsiveness_timer->stop();
|
||||
did_become_responsive();
|
||||
}
|
||||
|
||||
size_t decoded_bytes = 0;
|
||||
for (size_t index = 0; index < bytes.size(); index += decoded_bytes) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue