From ec7bbadce925322f29346b692a0b5ac337560bba Mon Sep 17 00:00:00 2001 From: antirez Date: Fri, 22 Jul 2011 12:11:40 +0200 Subject: [PATCH] Close the listening sockets. Apparently this allows faster restarts. --- src/redis.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/redis.c b/src/redis.c index 2d3f0403d..1d732e91f 100644 --- a/src/redis.c +++ b/src/redis.c @@ -1118,6 +1118,10 @@ int prepareForShutdown() { redisLog(REDIS_NOTICE,"Removing the pid file."); unlink(server.pidfile); } + /* Close the listening sockets. Apparently this allows faster restarts. */ + if (server.ipfd != -1) close(server.ipfd); + if (server.sofd != -1) close(server.sofd); + redisLog(REDIS_WARNING,"Redis is now ready to exit, bye bye..."); return REDIS_OK; }