Skip to content

Commit

Permalink
Merge pull request #392 from Geod24/mlang/ScopeDestructor
Browse files Browse the repository at this point in the history
Make TCPConnection/UDPConnection postblit/dtor scope
  • Loading branch information
s-ludwig committed Feb 20, 2024
2 parents 97a0c5b + baa56ec commit c3f932c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions source/vibe/core/net.d
Original file line number Diff line number Diff line change
Expand Up @@ -549,13 +549,13 @@ struct TCPConnection {
}

this(this)
nothrow {
scope nothrow {
if (m_socket != StreamSocketFD.invalid)
eventDriver.sockets.addRef(m_socket);
}

~this()
nothrow {
scope nothrow {
if (m_socket != StreamSocketFD.invalid && m_context && m_context.driver)
.releaseHandle!"sockets"(m_socket, m_context.driver);
}
Expand Down Expand Up @@ -1007,13 +1007,13 @@ struct UDPConnection {


this(this)
nothrow {
scope nothrow {
if (m_socket != DatagramSocketFD.invalid)
eventDriver.sockets.addRef(m_socket);
}

~this()
nothrow {
scope nothrow {
if (m_socket != DatagramSocketFD.invalid)
releaseHandle!"sockets"(m_socket, m_context.driver);
}
Expand Down

0 comments on commit c3f932c

Please sign in to comment.