- timeout_end = time(NULL)+maxtime;
- timeout = false;
- if ((this->fd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
- {
- // theres been a boo-boo... no more fd's left for us, woe is me!
- Srv->Log(DEBUG,"Ident: socket failed for: "+std::string(user->ip));
- return false;
- }
- inet_aton(user->ip,&addy);
- addr.sin_family = AF_INET;
- addr.sin_addr = addy;
- addr.sin_port = htons(113);
-
- int flags;
- 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)
- {
- // theres been an error, but EINPROGRESS just means 'right, im on it, call me later'
- if (errno != EINPROGRESS)
- {
- // ... so that error isnt fatal, like the rest.
- Srv->Log(DEBUG,"Ident: connect failed for: "+std::string(user->ip));
- return false;
- }
- }
- Srv->Log(DEBUG,"Ident: successful connect associated with user "+std::string(user->nick));
- this->u = user;
- this->state = IDENT_STATE_CONNECT;
- return true;