summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;