Skip to content

Commit

Permalink
Make sure we tidy up the connection properly
Browse files Browse the repository at this point in the history
  • Loading branch information
0xTim committed Apr 4, 2024
1 parent 4d9cb8c commit dc881da
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Sources/Vapor/HTTP/Server/HTTPServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,8 @@ public final class HTTPServer: Server, Sendable {
}
self.configuration.logger.debug("HTTP server shutting down")
self.didShutdown.withLockedValue { $0 = true }
// Make sure we remove the connection reference in case we want to start up again
self.connection.withLockedValue { $0 = nil }
}

public func shutdown() async {
Expand All @@ -408,6 +410,8 @@ public final class HTTPServer: Server, Sendable {
}
self.configuration.logger.debug("HTTP server shutting down")
self.didShutdown.withLockedValue { $0 = true }
// Make sure we remove the connection reference in case we want to start up again
self.connection.withLockedValue { $0 = nil }
}

public var localAddress: SocketAddress? {
Expand Down

0 comments on commit dc881da

Please sign in to comment.