diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-01 20:18:10 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-01 20:18:10 +0000 |
commit | 9c9968229fd0cc3ae346369772b41c9dbd857873 (patch) | |
tree | 38c2b6adcfd0784034385384cca99a60c732867c /src/modules/m_spanningtree/treesocket1.cpp | |
parent | f40ede375016051d9026710122a40a5bbdd93c9f (diff) |
Much more detailed logging of lowlevel socket errors to the +l snomask
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6856 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree/treesocket1.cpp')
-rw-r--r-- | src/modules/m_spanningtree/treesocket1.cpp | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 21c6de118..6176d0201 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -205,24 +205,35 @@ bool TreeSocket::OnConnected() void TreeSocket::OnError(InspSocketError e) { - /* We don't handle this method, because all our - * dirty work is done in OnClose() (see below) - * which is still called on error conditions too. - */ - if (e == I_ERR_CONNECT) - { - this->Instance->SNO->WriteToSnoMask('l',"Connection failed: Connection to \002"+myhost+"\002 refused"); - Link* MyLink = Utils->FindLink(myhost); - if (MyLink) - Utils->DoFailOver(MyLink); - } - else + Link* MyLink; + + switch (e) { - if ((errno) && (errno != EINPROGRESS) && (errno != EAGAIN)) - { - std::string errstr = strerror(errno); - this->Instance->SNO->WriteToSnoMask('l',"Connection to \002"+myhost+"\002 failed with error: " + errstr); - } + case I_ERR_CONNECT: + this->Instance->SNO->WriteToSnoMask('l',"Connection failed: Connection to \002"+myhost+"\002 refused"); + MyLink = Utils->FindLink(myhost); + if (MyLink) + Utils->DoFailOver(MyLink); + break; + case I_ERR_SOCKET: + this->Instance->SNO->WriteToSnoMask('l',"Connection failed: Could not create socket"); + break; + case I_ERR_BIND: + this->Instance->SNO->WriteToSnoMask('l',"Connection failed: Error binding socket to address or port"); + break; + case I_ERR_WRITE: + this->Instance->SNO->WriteToSnoMask('l',"Connection failed: I/O error on connection"); + break; + case I_ERR_NOMOREFDS: + this->Instance->SNO->WriteToSnoMask('l',"Connection failed: Operating system is out of file descriptors!"); + break; + default: + if ((errno) && (errno != EINPROGRESS) && (errno != EAGAIN)) + { + std::string errstr = strerror(errno); + this->Instance->SNO->WriteToSnoMask('l',"Connection to \002"+myhost+"\002 failed with OS error: " + errstr); + } + break; } } |