- this->cbindip = connectbindip;
- this->fd = -1;
- this->ServerInstance = SI;
- strlcpy(host,ipaddr.c_str(),MAXBUF);
- this->Timeout = NULL;
-
- strlcpy(this->host,ipaddr.c_str(),MAXBUF);
- this->port = aport;
-
- irc::sockets::sockaddrs testaddr;
- if (!irc::sockets::aptosa(host, aport, &testaddr))
- {
- this->ServerInstance->Logs->Log("SOCKET", DEBUG,"BUG: Hostname passed to BufferedSocket, rather than an IP address!");
- this->OnError(I_ERR_CONNECT);
- this->Close();
- this->fd = -1;
- this->state = I_ERROR;
- return;
- }
- else
- {
- strlcpy(this->IP,host,MAXBUF);
- if (!this->DoConnect(maxtime))
- {
- this->OnError(I_ERR_CONNECT);
- this->Close();
- this->fd = -1;
- this->state = I_ERROR;
- return;
- }
- }
-}
-
-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)
-{
- irc::sockets::sockaddrs s;
- if (!irc::sockets::aptosa(current_ip.c_str(), 0, &s))
- {
- errno = EADDRNOTAVAIL;
- return false;
- }
-
- if (ServerInstance->SE->Bind(this->fd, &s.sa, sizeof(s)) < 0)