- insp_inaddr n;
- ConfigReader Conf(this->Instance);
-
- this->Instance->Log(DEBUG,"In InspSocket::BindAddr()");
- for (int j =0; j < Conf.Enumerate("bind"); j++)
- {
- std::string Type = Conf.ReadValue("bind","type",j);
- std::string IP = Conf.ReadValue("bind","address",j);
- if (Type == "servers")
- {
- if ((IP != "*") && (IP != "127.0.0.1") && (IP != ""))
- {
- insp_sockaddr s;
-
- if (insp_aton(IP.c_str(),&n) > 0)
- {
- this->Instance->Log(DEBUG,"Found an IP to bind to: %s",IP.c_str());
-#ifdef IPV6
- s.sin6_addr = n;
- s.sin6_family = AF_FAMILY;
-#else
- s.sin_addr = n;
- s.sin_family = AF_FAMILY;
-#endif
- if (bind(this->fd,(struct sockaddr*)&s,sizeof(s)) < 0)
- {
- this->Instance->Log(DEBUG,"Cant bind()");
- this->state = I_ERROR;
- this->OnError(I_ERR_BIND);
- this->fd = -1;
- return false;
- }
- this->Instance->Log(DEBUG,"bind() reports outbound fd bound to ip %s",IP.c_str());
- return true;
- }
- else
- {
- this->Instance->Log(DEBUG,"Address '%s' was not an IP address",IP.c_str());
- }
- }
- }
- }
- this->Instance->Log(DEBUG,"Found no suitable IPs to bind, binding INADDR_ANY");
+ std::string::size_type i = recvq.find(delim);
+ if (i == std::string::npos)
+ return false;
+ line.assign(recvq, 0, i);
+ recvq.erase(0, i + 1);