this->IsIOHooked = false;
if (listening)
{
- if ((this->fd = OpenTCPSocket()) == ERROR)
+ if ((this->fd = OpenTCPSocket(host)) == ERROR)
{
this->fd = -1;
this->state = I_ERROR;
}
else
{
- if (!SI->BindSocket(this->fd,this->client,this->server,aport,(char*)ipaddr.c_str()))
+ if (!SI->BindSocket(this->fd,aport,(char*)ipaddr.c_str()))
{
this->Close();
this->fd = -1;
}
return;
}
- }
+ }
}
else
{
std::string IP = Conf.ReadValue("bind","address",j);
if (Type == "servers")
{
- if ((IP != "*") && (IP != "127.0.0.1") && (IP != ""))
+ if ((IP != "*") && (IP != "127.0.0.1") && (IP != "") && (IP != "::1"))
{
insp_sockaddr s;
if (insp_aton(IP.c_str(),&n) > 0)
{
#ifdef IPV6
- s.sin6_addr = n;
+ memcpy(&s.sin6_addr, &n, sizeof(n));
s.sin6_family = AF_FAMILY;
#else
s.sin_addr = n;
insp_aton(this->IP,&addy);
#ifdef IPV6
addr.sin6_family = AF_FAMILY;
- memcpy(&addr.sin6_addr, &addy, sizeof(insp_inaddr));
+ memcpy(&addr.sin6_addr, &addy, sizeof(addy));
addr.sin6_port = htons(this->port);
#else
addr.sin_family = AF_FAMILY;
addr.sin_port = htons(this->port);
#endif
- int flags;
- flags = fcntl(this->fd, F_GETFL, 0);
+ int flags = fcntl(this->fd, F_GETFL, 0);
fcntl(this->fd, F_SETFL, flags | O_NONBLOCK);
if (connect(this->fd, (sockaddr*)&this->addr,sizeof(this->addr)) == -1)