зеркало из https://github.com/github/ruby.git
ext/socket/ipsocket.c: Use SO_REUSEADDR for local_host/port
Sometimes ruby/spec fails when trying to specify local_host and local_port for TCPSocket.open. https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris11s-sunc/ruby-master/log/20190610T192504Z.fail.html.gz
This commit is contained in:
Родитель
6096baea5d
Коммит
de4b2930f7
|
@ -99,6 +99,11 @@ init_inetsock_internal(struct inetsock_arg *arg)
|
|||
}
|
||||
else {
|
||||
if (lres) {
|
||||
#if !defined(_WIN32) && !defined(__CYGWIN__)
|
||||
status = 1;
|
||||
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
|
||||
(char*)&status, (socklen_t)sizeof(status));
|
||||
#endif
|
||||
status = bind(fd, lres->ai_addr, lres->ai_addrlen);
|
||||
local = status;
|
||||
syscall = "bind(2)";
|
||||
|
|
Загрузка…
Ссылка в новой задаче