diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-07-27 18:50:07 +0200 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-07-27 18:50:07 +0200 |
commit | 984004505b8b5eea2467b703411fccac831ee780 (patch) | |
tree | a9fb42d4d8a4f4d1d42c00d53a9ad204459d06ae /src | |
parent | d5e7f1d01dd80fd78d895c843de4eba198bd7d60 (diff) |
m_spanningtree Add TreeServer::BeginBurst() that marks a server as bursting
Don't mark servers as bursting in the constructor
Diffstat (limited to 'src')
-rw-r--r-- | src/modules/m_spanningtree/server.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treeserver.cpp | 14 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treeserver.h | 5 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 2 |
4 files changed, 18 insertions, 5 deletions
diff --git a/src/modules/m_spanningtree/server.cpp b/src/modules/m_spanningtree/server.cpp index db23466c0..5da000f20 100644 --- a/src/modules/m_spanningtree/server.cpp +++ b/src/modules/m_spanningtree/server.cpp @@ -63,6 +63,8 @@ CmdResult CommandServer::HandleServer(TreeServer* ParentOfThis, std::vector<std: TreeServer* Node = new TreeServer(servername, description, sid, ParentOfThis, ParentOfThis->GetSocket(), lnk ? lnk->Hidden : false); + Node->BeginBurst(); + ServerInstance->SNO->WriteToSnoMask('L', "Server \002"+ParentOfThis->GetName()+"\002 introduced server \002"+servername+"\002 ("+description+")"); return CMD_SUCCESS; } diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp index 9a661416a..8ff4cbe7b 100644 --- a/src/modules/m_spanningtree/treeserver.cpp +++ b/src/modules/m_spanningtree/treeserver.cpp @@ -51,16 +51,12 @@ TreeServer::TreeServer() TreeServer::TreeServer(const std::string& Name, const std::string& Desc, const std::string& id, TreeServer* Above, TreeSocket* Sock, bool Hide) : Server(Name, Desc) , Parent(Above), Socket(Sock), sid(id), ServerUser(new FakeUser(id, this)) - , age(ServerInstance->Time()), Warned(false), UserCount(0), OperCount(0), rtt(0), Hidden(Hide) + , age(ServerInstance->Time()), Warned(false), UserCount(0), OperCount(0), rtt(0), StartBurst(0), Hidden(Hide) { CheckULine(); SetNextPingTime(ServerInstance->Time() + Utils->PingFreq); SetPingFlag(); - long ts = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000); - this->StartBurst = ts; - ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Server %s started bursting at time %lu", sid.c_str(), ts); - /* find the 'route' for this server (e.g. the one directly connected * to the local server, which we can use to reach it) * @@ -116,6 +112,14 @@ TreeServer::TreeServer(const std::string& Name, const std::string& Desc, const s Parent->AddChild(this); } +void TreeServer::BeginBurst(unsigned long startms) +{ + if (!startms) + startms = ServerInstance->Time() * 1000 + (ServerInstance->Time_ns() / 1000000); + this->StartBurst = startms; + ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Server %s started bursting at time %lu", sid.c_str(), startms); +} + const std::string& TreeServer::GetID() { return sid; diff --git a/src/modules/m_spanningtree/treeserver.h b/src/modules/m_spanningtree/treeserver.h index dcc89c3d2..192896cdb 100644 --- a/src/modules/m_spanningtree/treeserver.h +++ b/src/modules/m_spanningtree/treeserver.h @@ -199,6 +199,11 @@ class TreeServer : public Server */ bool IsBursting() const { return (StartBurst != 0); } + /** Set the bursting state of the server + * @param startms Time the server started bursting, if 0 or omitted, use current time + */ + void BeginBurst(unsigned long startms = 0); + CullResult cull(); /** Destructor diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index ef371212a..25cc751e4 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -378,6 +378,8 @@ void TreeSocket::FinishAuth(const std::string& remotename, const std::string& re MyRoot = new TreeServer(remotename, remotedesc, remotesid, Utils->TreeRoot, this, hidden); + // Mark the server as bursting + MyRoot->BeginBurst(); this->DoBurst(MyRoot); CommandServer::Builder(MyRoot).Forward(MyRoot); |