mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
TCPServer use SO_REUSEADDR
This commit is contained in:
@@ -262,6 +262,7 @@ class TCPServer
|
||||
ai = Addrinfo.getaddrinfo(host, service, nil, nil, nil, Socket::AI_PASSIVE)[0]
|
||||
@init_with_fd = true
|
||||
super(Socket._socket(ai.afamily, Socket::SOCK_STREAM, 0), "r+")
|
||||
self.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true)
|
||||
Socket._bind(self.fileno, ai.to_sockaddr)
|
||||
listen(5)
|
||||
self
|
||||
|
||||
Reference in New Issue
Block a user