Set SO_REUSEADDR on all sockets

v0.7.4-release
Ryan Dahl 2010-07-17 23:10:38 -07:00
parent 11a784d6da
commit 341e41726f
1 changed files with 2 additions and 0 deletions

View File

@ -74,6 +74,8 @@ static inline bool SetNonBlock(int fd) {
static inline bool SetSockFlags(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); return SetNonBlock(fd) && SetCloseOnExec(fd);
} }