Skip to content

Commit

Permalink
Make TCPConnection/UDPConnection postblit/dtor scope
Browse files Browse the repository at this point in the history
While building a project depending on vibe-http,
I got the following deprecation message:
```
vibe-core/source/vibe/core/stream.d(189,7):        scope variable `source` calling non-scope member function `TCPConnection.~this()`
```
Fixing the issue with the destructor shifts it to the postblit,
so both needs to be fixed. The same fix was applied to
the UDPConnection as a result.
  • Loading branch information
Geod24 committed Feb 20, 2024
1 parent 97a0c5b commit baa56ec
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 baa56ec

Please sign in to comment.