aboutsummaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/treesocket1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/m_spanningtree/treesocket1.cpp')
-rw-r--r--src/modules/m_spanningtree/treesocket1.cpp17
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