+ }
+}
+
+void BufferedSocket::SetQueues()
+{
+ // attempt to increase socket sendq and recvq as high as its possible
+ int sendbuf = 32768;
+ int recvbuf = 32768;
+ if(setsockopt(this->fd,SOL_SOCKET,SO_SNDBUF,(const char *)&sendbuf,sizeof(sendbuf)) || setsockopt(this->fd,SOL_SOCKET,SO_RCVBUF,(const char *)&recvbuf,sizeof(sendbuf)))
+ {
+ //this->ServerInstance->Log(DEFAULT, "Could not increase SO_SNDBUF/SO_RCVBUF for socket %u", GetFd());
+ ; // 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.
+ }
+}
+
+bool BufferedSocket::DoBindMagic(const std::string ¤t_ip, bool v6)
+{
+ /* The [2] is required because we may write a sockaddr_in6 here, and sockaddr_in6 is larger than sockaddr, where sockaddr_in4 is not. */
+ socklen_t size = sizeof(sockaddr_in);
+ sockaddr* s = new sockaddr[2];
+#ifdef IPV6
+ if (v6)
+ {
+ in6_addr n;
+ if (inet_pton(AF_INET6, current_ip.c_str(), &n) > 0)
+ {
+ memcpy(&((sockaddr_in6*)s)->sin6_addr, &n, sizeof(sockaddr_in6));
+ ((sockaddr_in6*)s)->sin6_port = 0;
+ ((sockaddr_in6*)s)->sin6_family = AF_INET6;
+ size = sizeof(sockaddr_in6);
+ }