diff options
author | Yossi Gottlieb <yossigo@gmail.com> | 2020-03-22 14:47:44 +0200 |
---|---|---|
committer | Yossi Gottlieb <yossigo@gmail.com> | 2020-03-22 14:47:44 +0200 |
commit | 2dab5015b79f7fe86c2efb0e4e7f26548c8096c9 (patch) | |
tree | 83fb07db563bdf1ec87b2160ee15f37c23f82746 /src/networking.c | |
parent | 4c08ae3ff698025b7100648faae5a0ac3f9f31fc (diff) | |
download | redis-2dab5015b79f7fe86c2efb0e4e7f26548c8096c9.tar.gz |
Fix crashes related to failed/rejected accepts.
Diffstat (limited to 'src/networking.c')
-rw-r--r-- | src/networking.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/networking.c b/src/networking.c index 69d59a59b..a550e4040 100644 --- a/src/networking.c +++ b/src/networking.c @@ -786,7 +786,7 @@ void clientAcceptHandler(connection *conn) { serverLog(LL_WARNING, "Error accepting a client connection: %s", connGetLastError(conn)); - freeClient(c); + freeClientAsync(c); return; } @@ -828,7 +828,7 @@ void clientAcceptHandler(connection *conn) { /* Nothing to do, Just to avoid the warning... */ } server.stat_rejected_conn++; - freeClient(c); + freeClientAsync(c); return; } } @@ -887,9 +887,10 @@ static void acceptCommonHandler(connection *conn, int flags, char *ip) { */ if (connAccept(conn, clientAcceptHandler) == C_ERR) { char conninfo[100]; - serverLog(LL_WARNING, - "Error accepting a client connection: %s (conn: %s)", - connGetLastError(conn), connGetInfo(conn, conninfo, sizeof(conninfo))); + if (connGetState(conn) == CONN_STATE_ERROR) + serverLog(LL_WARNING, + "Error accepting a client connection: %s (conn: %s)", + connGetLastError(conn), connGetInfo(conn, conninfo, sizeof(conninfo))); freeClient(connGetPrivateData(conn)); return; } |