this->Instance->Log(DEBUG,"Write error on socket: %s",strerror(errno));
this->OnError(I_ERR_WRITE);
this->state = I_ERROR;
+ this->Instance->SE->DelFd(this);
+ this->Close();
return true;
}
}
{
if (ServerInstance->SE->GetRef(this->sfd) != this->sock)
{
- ServerInstance->Log(DEBUG,"No FD or socket ref");
+ ServerInstance->Log(DEBUG,"Our socket has been deleted before the timeout was reached.");
return;
}
this->sock->OnTimeout();
this->sock->OnError(I_ERR_TIMEOUT);
this->sock->timeout = true;
- this->sock->state = I_ERROR;
ServerInstance->SE->DelFd(this->sock);
+ /* NOTE: We must set this AFTER DelFd, as we added
+ * this socket whilst writeable. This means that we
+ * must DELETE the socket whilst writeable too!
+ */
+ this->sock->state = I_ERROR;
this->sock->Close();
delete this->sock;
return;