- ConfigReader Conf(this->ServerInstance);
- bool v6 = false;
-
- // Case one: If they provided an IP, try bind it
- if (!ip_to_bind.empty())
- {
-#ifdef IPV6
- // Check whether or not they are binding to an IPv6 IP..
- if (ip_to_bind.find(':') != std::string::npos)
- v6 = true;
-#endif
- // And if it fails, don't do anything.
- return this->DoBindMagic(ip_to_bind, v6);
- }
-
- for (int j = 0; j < Conf.Enumerate("bind"); j++)
- {
- // We only want to try bind to a server ip.
- if (Conf.ReadValue("bind","type",j) != "servers")
- continue;
-
- // set current IP to the <bind> tag
- std::string current_ip = Conf.ReadValue("bind","address",j);
-
-#ifdef IPV6
- // Check whether this <bind> is for an ipv6 address
- if (current_ip.find(':') != std::string::npos)
- v6 = true;
- else
- v6 = false;
-#endif
-
- // Make sure IP is nothing local
- if (current_ip == "*" || current_ip == "127.0.0.1" || current_ip.empty() || current_ip == "::1")
- continue;
-
- // Try bind, don't fail if it doesn't bind though.
- if (this->DoBindMagic(current_ip, v6))
- return true;
- }
-
- // NOTE: You may wonder WTF we are returning *true* here, but that is because there were no custom binds setup, and so we have nothing to do
- // (remember, outgoing connections without binding are perfectly ok).
- ServerInstance->Logs->Log("SOCKET", DEBUG,"nothing in the config to bind()!");
- return true;
+ // attempt to increase socket sendq and recvq as high as its possible
+ int sendbuf = 32768;
+ int recvbuf = 32768;
+ setsockopt(fd,SOL_SOCKET,SO_SNDBUF,(const char *)&sendbuf,sizeof(sendbuf));
+ setsockopt(fd,SOL_SOCKET,SO_RCVBUF,(const char *)&recvbuf,sizeof(recvbuf));
+ // on failure, do nothing. I'm a little sick of people trying to interpret this message as a result of why their incorrect setups don't work.