diff options
| author | 2020-11-27 03:04:25 +0000 | |
|---|---|---|
| committer | 2020-11-27 03:05:44 +0000 | |
| commit | a66d694e494b8bafe9b30ac1f2e09a2f1470605e (patch) | |
| tree | ef5583aa0f7399c8801701852970f082ecb8835e /src/modules/m_spanningtree/treesocket1.cpp | |
| parent | Merge tag 'v3.8.1' into master. (diff) | |
Convert CapabData to be a unique_ptr.
Diffstat (limited to 'src/modules/m_spanningtree/treesocket1.cpp')
| -rw-r--r-- | src/modules/m_spanningtree/treesocket1.cpp | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/src/modules/m_spanningtree/treesocket1.cpp b/src/modules/m_spanningtree/treesocket1.cpp index 1bef9cbb4..6448f7f8b 100644 --- a/src/modules/m_spanningtree/treesocket1.cpp +++ b/src/modules/m_spanningtree/treesocket1.cpp @@ -42,13 +42,11 @@ TreeSocket::TreeSocket(std::shared_ptr<Link> link, std::shared_ptr<Autoconnect> myac, const irc::sockets::sockaddrs& dest) : linkID(link->Name) , LinkState(CONNECTING) + , capab(std::make_unique<CapabData>(dest)) , age(ServerInstance->Time()) { - capab = new CapabData; capab->link = link; capab->ac = myac; - capab->capab_phase = 0; - capab->remotesa = dest; irc::sockets::sockaddrs bind; memset(&bind, 0, sizeof(bind)); @@ -81,12 +79,9 @@ TreeSocket::TreeSocket(int newfd, ListenSocket* via, irc::sockets::sockaddrs* cl : BufferedSocket(newfd) , linkID("inbound from " + client->addr()) , LinkState(WAIT_AUTH_1) + , capab(std::make_unique<CapabData>(*client)) , age(ServerInstance->Time()) { - capab = new CapabData; - capab->capab_phase = 0; - capab->remotesa = *client; - for (ListenSocket::IOHookProvList::iterator i = via->iohookprovs.begin(); i != via->iohookprovs.end(); ++i) { ListenSocket::IOHookProvRef& iohookprovref = *i; @@ -112,8 +107,7 @@ void TreeSocket::CleanNegotiationInfo() // connect is good, reset the autoconnect block (if used) if (capab->ac) capab->ac->position = -1; - delete capab; - capab = NULL; + capab.reset(); } CullResult TreeSocket::cull() @@ -124,11 +118,6 @@ CullResult TreeSocket::cull() return this->BufferedSocket::cull(); } -TreeSocket::~TreeSocket() -{ - delete capab; -} - /** When an outbound connection finishes connecting, we receive * this event, and must do CAPAB negotiation with the other * side. If the other side is happy, as outlined in the server |
