summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2014-05-31 21:17:46 -0400
committerAdam <Adam@anope.org>2014-05-31 21:17:46 -0400
commit54e98f017c95feec8265d7e5c1d0b29fc5c716ea (patch)
treee4dde7b6492bcab9dd4ae3e4f952594897595b17 /src
parentbb7706d0f709c780c4733d696dc152d63b7fb00f (diff)
Always log when the uplink socket errors, and give possibly helpful advise
Diffstat (limited to 'src')
-rw-r--r--src/uplink.cpp16
1 files changed, 14 insertions, 2 deletions
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)