提交 d514d777 编写于 作者: J John Ferlan 提交者: Martin Kletzander

rpc: Check and message setsockopt()

Check status when attempting to set SO_REUSEADDR flag on outgoing connection
On failure, VIR_WARN(), but continue to connect. This code path is on the
sender side where the setting is just a hint and would only take effect if
the sender is overflowed with TCP connections.  Inability to set doesn't mean
failure to establish a connection.
上级 4d4a8aa9
......@@ -473,7 +473,9 @@ int virNetSocketNewConnectTCP(const char *nodename,
goto error;
}
setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
VIR_WARN("Unable to enable port reuse");
}
if (connect(fd, runp->ai_addr, runp->ai_addrlen) >= 0)
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册