From 7c76026791359dd895a485e36134b3b40c2fc43a Mon Sep 17 00:00:00 2001 From: Max Lv Date: Mon, 29 Aug 2016 13:32:03 +0800 Subject: [PATCH] Shutdown socket if failed to handshake --- src/server.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/server.c b/src/server.c index 4089f07f..bf5b4c36 100644 --- a/src/server.c +++ b/src/server.c @@ -301,6 +301,7 @@ static void report_addr(int fd) if (peer_name != NULL) { LOGE("failed to handshake with %s", peer_name); } + shutdown(fd, SHUT_RDWR); } int setfastopen(int fd) @@ -736,6 +737,7 @@ static void server_recv_cb(EV_P_ ev_io *w, int revents) } } } + shutdown(server->fd, SHUT_RDWR); close_and_free_server(EV_A_ server); return; }