mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:47:34 +00:00
LibIPC: Remove unused DisconnectedEvent mechanism
This was previously used to defer handling disconnections until the next event loop iteration. We now achieve the same with simple use of deferred_invoke(). :^)
This commit is contained in:
parent
4873e2bb53
commit
8d574c7363
1 changed files with 0 additions and 42 deletions
|
@ -30,33 +30,6 @@
|
|||
|
||||
namespace IPC {
|
||||
|
||||
class Event : public Core::Event {
|
||||
public:
|
||||
enum Type {
|
||||
Invalid = 2000,
|
||||
Disconnected,
|
||||
};
|
||||
Event() { }
|
||||
explicit Event(Type type)
|
||||
: Core::Event(type)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class DisconnectedEvent : public Event {
|
||||
public:
|
||||
explicit DisconnectedEvent(int client_id)
|
||||
: Event(Disconnected)
|
||||
, m_client_id(client_id)
|
||||
{
|
||||
}
|
||||
|
||||
int client_id() const { return m_client_id; }
|
||||
|
||||
private:
|
||||
int m_client_id { 0 };
|
||||
};
|
||||
|
||||
template<typename T, class... Args>
|
||||
NonnullRefPtr<T> new_client_connection(Args&&... args)
|
||||
{
|
||||
|
@ -98,21 +71,6 @@ public:
|
|||
|
||||
virtual void die() = 0;
|
||||
|
||||
protected:
|
||||
void event(Core::Event& event) override
|
||||
{
|
||||
if (event.type() == Event::Disconnected) {
|
||||
#ifdef IPC_DEBUG
|
||||
int client_id = static_cast<const DisconnectedEvent&>(event).client_id();
|
||||
dbg() << *this << ": Client disconnected: " << client_id;
|
||||
#endif
|
||||
this->die();
|
||||
return;
|
||||
}
|
||||
|
||||
Core::Object::event(event);
|
||||
}
|
||||
|
||||
private:
|
||||
int m_client_id { -1 };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue