diff options
| author | 2009-09-21 13:26:31 +0000 | |
|---|---|---|
| committer | 2009-09-21 13:26:31 +0000 | |
| commit | e2af2347fc035d702e45f12e772223a8d578410d (patch) | |
| tree | bfd80aac2858a9f4faedc316794fc1051dbaa72c /src/modules/m_spanningtree/treesocket2.cpp | |
| parent | Remove mistaken duplicate check for fake users (diff) | |
Create StreamSocket for IO hooking implementation
Fixes the SSL SendQ bug
Removes duplicate code between User and BufferedSocket
Simplify SSL module API
Simplify EventHandler API (Readable/Writeable moved to SE)
Add hook for culled objects to invoke callbacks prior to destructor
Replace SocketCull with GlobalCull now that sockets can close themselves
Shorten common case of user read/parse/write path:
User::Write is now zero-copy up to syscall/SSL invocation
User::Read has only two copy/scan passes from read() to ProcessCommand
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11752 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree/treesocket2.cpp')
| -rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 793802781..cf537f05b 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -32,7 +32,7 @@ bool TreeSocket::Error(parameterlist ¶ms) { if (params.size() < 1) return false; - this->ServerInstance->SNO->WriteToSnoMask('l',"ERROR from %s: %s",(!InboundServerName.empty() ? InboundServerName.c_str() : myhost.c_str()),params[0].c_str()); + ServerInstance->SNO->WriteToSnoMask('l',"ERROR from %s: %s",(!InboundServerName.empty() ? InboundServerName.c_str() : myhost.c_str()),params[0].c_str()); /* we will return false to cause the socket to close. */ return false; } @@ -126,9 +126,7 @@ bool TreeSocket::ProcessLine(std::string &line) } else { - // XXX ...wtf. - irc::string error = "Invalid command in negotiation phase: " + command; - this->SendError(assign(error)); + this->SendError(std::string("Invalid command in negotiation phase: ") + command.c_str()); return false; } break; @@ -171,7 +169,7 @@ bool TreeSocket::ProcessLine(std::string &line) Link* lnk = Utils->FindLink(InboundServerName); - Node = new TreeServer(this->Utils, this->ServerInstance, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false); + Node = new TreeServer(this->Utils, ServerInstance, InboundServerName, InboundDescription, InboundSID, Utils->TreeRoot, this, lnk ? lnk->Hidden : false); Utils->TreeRoot->AddChild(Node); parameterlist sparams; @@ -242,7 +240,7 @@ bool TreeSocket::ProcessLine(std::string &line) */ std::string direction = prefix; - User *t = this->ServerInstance->FindUUID(prefix); + User *t = ServerInstance->FindUUID(prefix); if (t) { /* Find UID */ @@ -316,7 +314,7 @@ bool TreeSocket::ProcessLine(std::string &line) } else if ((command == "NOTICE" || command == "PRIVMSG") && (Utils->IsServer(prefix))) { - return this->ServerMessage(assign(command), prefix, params, sourceserv); + return ServerMessage(assign(command), prefix, params, sourceserv); } else if (command == "STATS") { @@ -487,7 +485,7 @@ bool TreeSocket::ProcessLine(std::string &line) // Set prefix server as bursting if (!ServerSource) { - this->ServerInstance->SNO->WriteToSnoMask('l', "WTF: Got BURST from a nonexistant server(?): %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str())); + ServerInstance->SNO->WriteToSnoMask('l', "WTF: Got BURST from a nonexistant server(?): %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str())); return false; } @@ -498,7 +496,7 @@ bool TreeSocket::ProcessLine(std::string &line) { if (!ServerSource) { - this->ServerInstance->SNO->WriteToSnoMask('l', "WTF: Got ENDBURST from a nonexistant server(?): %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str())); + ServerInstance->SNO->WriteToSnoMask('l', "WTF: Got ENDBURST from a nonexistant server(?): %s", (ServerSource ? ServerSource->GetName().c_str() : prefix.c_str())); return false; } @@ -515,7 +513,7 @@ bool TreeSocket::ProcessLine(std::string &line) * Not a special s2s command. Emulate the user doing it. * This saves us having a huge ugly command parser again. */ - User* who = this->ServerInstance->FindUUID(prefix); + User* who = ServerInstance->FindUUID(prefix); if (ServerSource) { @@ -546,7 +544,7 @@ bool TreeSocket::ProcessLine(std::string &line) * On nick messages, check that the nick doesnt already exist here. * If it does, perform collision logic. */ - User* x = this->ServerInstance->FindNickOnly(params[0]); + User* x = ServerInstance->FindNickOnly(params[0]); if ((x) && (x != who)) { int collideret = 0; @@ -564,7 +562,7 @@ bool TreeSocket::ProcessLine(std::string &line) } } - switch (this->ServerInstance->CallCommandHandler(command.c_str(), params, who)) + switch (ServerInstance->CallCommandHandler(command.c_str(), params, who)) { case CMD_INVALID: /* @@ -607,13 +605,15 @@ void TreeSocket::OnTimeout() { if (this->LinkState == CONNECTING) { - this->ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Connection to \002%s\002 timed out.", myhost.c_str()); + ServerInstance->SNO->WriteToSnoMask('l', "CONNECT: Connection to \002%s\002 timed out.", myhost.c_str()); Utils->DoFailOver(myautoconnect); } } -void TreeSocket::OnClose() +void TreeSocket::Close() { + this->BufferedSocket::Close(); + // Test fix for big fuckup if (this->LinkState != CONNECTED) return; @@ -634,10 +634,10 @@ void TreeSocket::OnClose() if (!quitserver.empty()) { - this->ServerInstance->SNO->WriteToSnoMask('l', "Connection to '\2%s\2' failed.",quitserver.c_str()); + ServerInstance->SNO->WriteToSnoMask('l', "Connection to '\2%s\2' failed.",quitserver.c_str()); time_t server_uptime = ServerInstance->Time() - this->age; if (server_uptime) - this->ServerInstance->SNO->WriteToSnoMask('l', "Connection to '\2%s\2' was established for %s", quitserver.c_str(), Utils->Creator->TimeToStr(server_uptime).c_str()); + ServerInstance->SNO->WriteToSnoMask('l', "Connection to '\2%s\2' was established for %s", quitserver.c_str(), Utils->Creator->TimeToStr(server_uptime).c_str()); } } |
