mirror of https://github.com/OpenTTD/OpenTTD
(svn r15980) -Codechange: don't try to bind to the same socket twice; it's quite pointless.
parent
c2152fa31f
commit
18146572b0
|
@ -187,6 +187,13 @@ SOCKET NetworkAddress::Resolve(int family, int socktype, int flags, SocketList *
|
||||||
|
|
||||||
SOCKET sock = INVALID_SOCKET;
|
SOCKET sock = INVALID_SOCKET;
|
||||||
for (struct addrinfo *runp = ai; runp != NULL; runp = runp->ai_next) {
|
for (struct addrinfo *runp = ai; runp != NULL; runp = runp->ai_next) {
|
||||||
|
/* When we are binding to multiple sockets, make sure we do not
|
||||||
|
* connect to one with exactly the same address twice. That's
|
||||||
|
* ofcourse totally unneeded ;) */
|
||||||
|
if (sockets != NULL) {
|
||||||
|
NetworkAddress address(runp->ai_addr, runp->ai_addrlen);
|
||||||
|
if (sockets->Find(address) != sockets->End()) continue;
|
||||||
|
}
|
||||||
sock = func(runp);
|
sock = func(runp);
|
||||||
if (sock == INVALID_SOCKET) continue;
|
if (sock == INVALID_SOCKET) continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue