From a66d694e494b8bafe9b30ac1f2e09a2f1470605e Mon Sep 17 00:00:00 2001
From: Sadie Powell
Date: Fri, 27 Nov 2020 03:04:25 +0000
Subject: Convert CapabData to be a unique_ptr.
---
src/modules/m_spanningtree/treesocket1.cpp | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
(limited to 'src/modules/m_spanningtree/treesocket1.cpp')
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, std::shared_ptr myac, const irc::sockets::sockaddrs& dest)
: linkID(link->Name)
, LinkState(CONNECTING)
+ , capab(std::make_unique(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(*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
--
cgit v1.3.1-10-gc9f91