- case I_CONNECTING:
- /* Our socket was in write-state, so delete it and re-add it
- * in read-state.
- */
- if (this->fd > -1)
- {
- this->Instance->SE->DelFd(this);
- this->SetState(I_CONNECTED);
- if (!this->Instance->SE->AddFd(this))
- return false;
- }
- if (Instance->Config->GetIOHook(this))
- {
- try
- {
- Instance->Config->GetIOHook(this)->OnRawSocketConnect(this->fd);
- }
- catch (CoreException& modexcept)
- {
- Instance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
- }
- }
- return this->OnConnected();
- break;
- case I_LISTENING:
- length = sizeof (client);
- incoming = accept (this->fd, (sockaddr*)&client,&length);
-
-#ifdef IPV6
- this->OnIncomingConnection(incoming, (char*)insp_ntoa(client.sin6_addr));
-#else
- this->OnIncomingConnection(incoming, (char*)insp_ntoa(client.sin_addr));
-#endif
-
- if (this->IsIOHooked)
- {
- try
- {
-#ifdef IPV6
- Instance->Config->GetIOHook(this)->OnRawSocketAccept(incoming, insp_ntoa(client.sin6_addr), this->port);
-#else
- Instance->Config->GetIOHook(this)->OnRawSocketAccept(incoming, insp_ntoa(client.sin_addr), this->port);
-#endif
- }
- catch (CoreException& modexcept)
- {
- Instance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason());
- }
- }
-
- this->SetQueues(incoming);
- return true;
- break;
- case I_CONNECTED:
- /* Process the read event */
- return this->OnDataReady();
- break;
- default:
- break;