X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Finspsocket.cpp;h=68e2c8f96aea8060ae25df558d4bbdda0a6f281e;hb=6bc3d71946b339a5a10ca621b029fe8a5b180d68;hp=6987d5ccd5c929c6c1797ae1a7b8f03ad49bf897;hpb=ed61aa1ed4b7418126bd99c62aa84d44e78b95ba;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 6987d5ccd..68e2c8f96 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -2,12 +2,9 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. - * E-mail: - * - * - * - * Written by Craig Edwards, Craig McLure, and others. + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * * This program is free but copyrighted software; see * the file COPYING for details. * @@ -265,9 +262,9 @@ void InspSocket::Close() { Instance->Config->GetIOHook(this)->OnRawSocketClose(this->fd); } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { - Instance->Log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); + Instance->Log(DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } this->OnClose(); @@ -296,9 +293,9 @@ char* InspSocket::Read() { MOD_RESULT = Instance->Config->GetIOHook(this)->OnRawSocketRead(this->fd,this->ibuf,sizeof(this->ibuf),result2); } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { - Instance->Log(DEBUG,"Module exception caught: %s",modexcept.GetReason()); + Instance->Log(DEFAULT,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } if (MOD_RESULT < 0) { @@ -390,10 +387,19 @@ bool InspSocket::FlushWriteBuffer() this->Close(); return true; } + else if (result == 0) + { + this->Instance->Log(DEBUG,"Write error on socket: EOF"); + this->OnError(I_ERR_WRITE); + this->state = I_ERROR; + this->Instance->SE->DelFd(this); + this->Close(); + return true; + } } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { - Instance->Log(DEBUG,"Module exception caught: %s",modexcept.GetReason()); + Instance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); return true; } } @@ -511,9 +517,9 @@ bool InspSocket::Poll() { Instance->Config->GetIOHook(this)->OnRawSocketConnect(this->fd); } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { - Instance->Log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); + Instance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } return this->OnConnected(); @@ -538,9 +544,9 @@ bool InspSocket::Poll() Instance->Config->GetIOHook(this)->OnRawSocketAccept(incoming, insp_ntoa(client.sin_addr), this->port); #endif } - catch (ModuleException& modexcept) + catch (CoreException& modexcept) { - Instance->Log(DEBUG,"Module exception cought: %s",modexcept.GetReason()); + Instance->Log(DEBUG,"%s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); } } @@ -631,7 +637,6 @@ void InspSocket::HandleEvent(EventType et, int errornum) } else { - Instance->Log(DEBUG,"State=%d CONNECTED=%d", this->state, I_CONNECTED); if (this->FlushWriteBuffer()) { this->Instance->SE->DelFd(this);