diff options
author | Adam <Adam@anope.org> | 2014-05-31 21:17:46 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-05-31 21:17:46 -0400 |
commit | 54e98f017c95feec8265d7e5c1d0b29fc5c716ea (patch) | |
tree | e4dde7b6492bcab9dd4ae3e4f952594897595b17 | |
parent | bb7706d0f709c780c4733d696dc152d63b7fb00f (diff) |
Always log when the uplink socket errors, and give possibly helpful advise
-rw-r--r-- | include/uplink.h | 1 | ||||
-rw-r--r-- | src/uplink.cpp | 16 |
2 files changed, 15 insertions, 2 deletions
diff --git a/include/uplink.h b/include/uplink.h index c7e3e1ccf..cc124fef1 100644 --- a/include/uplink.h +++ b/include/uplink.h @@ -25,6 +25,7 @@ namespace Uplink class UplinkSocket : public ConnectionSocket, public BufferedSocket { public: + bool error; UplinkSocket(); ~UplinkSocket(); bool ProcessRead() anope_override; diff --git a/src/uplink.cpp b/src/uplink.cpp index 549df85b3..8f54794a2 100644 --- a/src/uplink.cpp +++ b/src/uplink.cpp @@ -60,11 +60,22 @@ void Uplink::Connect() UplinkSocket::UplinkSocket() : Socket(-1, Config->Uplinks[Anope::CurrentUplink].ipv6), ConnectionSocket(), BufferedSocket() { + error = false; UplinkSock = this; } UplinkSocket::~UplinkSocket() { + if (!error) + { + this->OnError(""); + Module *protocol = ModuleManager::FindFirstOf(PROTOCOL); + if (protocol && !protocol->name.find("inspircd")) + Log(LOG_TERMINAL) << "Check that you have loaded m_spanningtree.so on InspIRCd, and are not connecting Anope to an SSL enabled port without configuring SSL in Anope (or vice versa)"; + else + Log(LOG_TERMINAL) << "Check that you are not connecting Anope to an SSL enabled port without configuring SSL in Anope (or vice versa)"; + } + if (IRCD && Servers::GetUplink() && Servers::GetUplink()->IsSynced()) { FOREACH_MOD(OnServerDisconnect, ()); @@ -136,10 +147,11 @@ void UplinkSocket::OnConnect() FOREACH_MOD(OnServerConnect, ()); } -void UplinkSocket::OnError(const Anope::string &error) +void UplinkSocket::OnError(const Anope::string &err) { Anope::string what = !this->flags[SF_CONNECTED] ? "Unable to connect to" : "Lost connection from"; - Log(LOG_TERMINAL) << what << " uplink #" << (Anope::CurrentUplink + 1) << " (" << Config->Uplinks[Anope::CurrentUplink].host << ":" << Config->Uplinks[Anope::CurrentUplink].port << ")" << (!error.empty() ? (": " + error) : ""); + Log(LOG_TERMINAL) << what << " uplink #" << (Anope::CurrentUplink + 1) << " (" << Config->Uplinks[Anope::CurrentUplink].host << ":" << Config->Uplinks[Anope::CurrentUplink].port << ")" << (!err.empty() ? (": " + err) : ""); + error |= !err.empty(); } UplinkSocket::Message::Message() : source(Me) |