void StreamSocket::Close()
{
- /* Save this, so we dont lose it,
- * otherise on failure, error messages
- * might be inaccurate.
- */
- int save = errno;
if (this->fd > -1)
{
if (IOHook)
ServerInstance->Logs->Log("SOCKET", DEFAULT,"%s threw an exception: %s",
modexcept.GetSource(), modexcept.GetReason());
}
+ IOHook = NULL;
}
ServerInstance->SE->Shutdown(this, 2);
ServerInstance->SE->DelFd(this);
ServerInstance->SE->Close(this);
fd = -1;
}
- errno = save;
}
CullResult StreamSocket::cull()
int rv = -1;
try
{
- while (!sendq.empty())
+ while (error.empty() && !sendq.empty())
{
if (sendq.size() > 1 && sendq[0].length() < 1024)
{
return;
// start out optimistic - we won't need to write any more
int eventChange = FD_WANT_EDGE_WRITE;
- while (sendq_len && eventChange == FD_WANT_EDGE_WRITE)
+ while (error.empty() && sendq_len && eventChange == FD_WANT_EDGE_WRITE)
{
// Prepare a writev() call to write all buffers efficiently
int bufcount = sendq.size();