summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2020-07-07 13:11:57 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2020-07-07 13:11:57 -0300
commitc801730eda827ea2662ef703f694a2abde33f4c0 (patch)
tree106ab1053a1364dc440881b4188f6d7974b63b51
parent81dd6b162351d93dae5d71a45df56ee1a74a36ca (diff)
downloadjet-c801730eda827ea2662ef703f694a2abde33f4c0.tar.gz
jet-c801730eda827ea2662ef703f694a2abde33f4c0.zip
Delete restarted clients
-rw-r--r--jet.cpp3
1 files changed, 3 insertions, 0 deletions
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;