delaying client disconnect using freeClientAsync()

- when a client is marked for closing (i.e. after protocol error) we are delaying
  it slightly by using freeClientAsync() instead of freeClient() as sometimes
  the latter was closing connection too fast without reply being actually sent
This commit is contained in:
Tomasz Poradowski
2019-09-29 11:18:56 +02:00
parent 2392f888f6
commit 331860908d
+12
View File
@@ -654,7 +654,13 @@ static void acceptCommonHandler(int fd, int flags, char *ip) {
/* Nothing to do, Just to avoid the warning... */
}
server.stat_rejected_conn++;
#ifdef _WIN32
//[tporadowski] freeClient was sometimes causing sent reply to be not delivered, so give it some
// additional time via freeing asynchronously
freeClientAsync(c);
#else
freeClient(c);
#endif
return;
}
@@ -1065,7 +1071,13 @@ int writeToClient(int fd, client *c, int handler_installed) {
/* Close connection after entire reply has been sent. */
if (c->flags & CLIENT_CLOSE_AFTER_REPLY) {
#ifdef _WIN32
//[tporadowski] freeClient was sometimes causing sent reply to be not delivered, so give it some
// additional time via freeing asynchronously
freeClientAsync(c);
#else
freeClient(c);
#endif
return C_ERR;
}
}