From c801730eda827ea2662ef703f694a2abde33f4c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Tue, 7 Jul 2020 13:11:57 -0300 Subject: Delete restarted clients --- jet.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jet.cpp b/jet.cpp index dd70f13..50572c2 100644 --- a/jet.cpp +++ b/jet.cpp @@ -64,6 +64,9 @@ int main() { int clientfd = accept(listener, 0, 0); ev.events = EPOLLIN | EPOLLET; ev.data.fd = clientfd; + if (clients[clientfd]) { + delete clients[clientfd]; + } Client *c = new Client(scratch); c->sockfd = clientfd; clients[clientfd] = c; -- cgit v1.2.3