From 341e41726febd84565cf7a4fbf2b13143faf7e0d Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sat, 17 Jul 2010 23:10:38 -0700 Subject: [PATCH] Set SO_REUSEADDR on all sockets --- src/node_net.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/node_net.cc b/src/node_net.cc index 622f41dd94..f5a15ccb7f 100644 --- a/src/node_net.cc +++ b/src/node_net.cc @@ -74,6 +74,8 @@ static inline bool SetNonBlock(int fd) { static inline bool SetSockFlags(int fd) { + int flags = 1; + setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void *)&flags, sizeof(flags)); return SetNonBlock(fd) && SetCloseOnExec(fd); }