- strlcpy(this->IP,ip,MAXBUF);
- this->ServerInstance = SI;
- if (this->fd > -1)
- this->ServerInstance->SE->AddFd(this);
-}
-
-BufferedSocket::BufferedSocket(InspIRCd* SI, const std::string &ipaddr, int aport, unsigned long maxtime, const std::string &connectbindip)
-{
- 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.
- }