Repository: vapor/vapor
File: Sources/Vapor/HTTP/Server/HTTPServer.swift (Swift)

Code before:
        self.didStart = .init(false)
        self.didShutdown = .init(false)
        self.connection = .init(nil)
    }
    
    public func start(address: BindAddress?) throws {
        var configuration = self.configuration
        
        switch address {
        case .none: 
            /// Use the configuration as is.
            break
        case .hostname(let hostname, let port): 
            /// Override the hostname, port, neither, or both.
            configuration.address = .hostname(hostname ?? configuration.hostname, port: port ?? configuration.port)
        case .unixDomainSocket: 
            /// Override the socket path.
            configuration.address = address!
        }

        /// Log starting message for debugging before attempting to start the server.
        let scheme = configuration.tlsConfiguration == nil ? "http" : "https"
        var addressDescription: String
        switch configuration.address {
        case .hostname(let hostname, let port):
            addressDescription = "\(scheme)://\(hostname ?? Configuration.defaultHostname):\(port ?? Configuration.defaultPort)"
        case .unixDomainSocket(let socketPath):
            addressDescription = "\(scheme)+unix: \(socketPath)"
        }
        self.configuration.logger.debug("Server starting on \(addressDescription)")
        
        /// Start the actual `HTTPServer`.
        try self.connection.withLockedValue {
            $0 = try HTTPServerConnection.start(
                application: self.application,
                server: self,
                responder: self.responder,
                configuration: configuration,
                on: self.eventLoopGroup
            ).wait()
        }

        /// Override configuration with actual address.
        /// This may differ from the provided configuation if port 0 was provided, for example.
        if let localAddress = self.localAddress {
            if let hostname = localAddress.hostname, let port = localAddress.port {
                configuration.port = port
                configuration.hostname = hostname
                addressDescription = "\(scheme)://\(hostname):\(port)"
            }
        }

Review comment (suggestion):
Same as before but a little more concise. At least I found `hostname ?? configuration.hostname` a little puzzling because that's always the same as just `configuration.hostname`.

Code after:
    
    public init(
        application: Application,
        responder: Responder,
        configuration: Configuration,
        on eventLoopGroup: EventLoopGroup = MultiThreadedEventLoopGroup.singleton
    ) {
        self.application = application
        self.responder = responder
        self._configuration = .init(configuration)
        self.eventLoopGroup = eventLoopGroup
        self.didStart = .init(false)
        self.didShutdown = .init(false)
        self.connection = .init(nil)
    }
    
    public func start(address: BindAddress?) throws {
        var configuration = self.configuration
        
        switch address {
        case .none: 
            /// Use the configuration as is.
            break
        case .hostname(let hostname, let port): 
            /// Override the hostname, port, neither, or both.
            configuration.address = .hostname(hostname ?? configuration.hostname, port: port ?? configuration.port)
        case .unixDomainSocket: 
            /// Override the socket path.
            configuration.address = address!
        }

        /// Log starting message for debugging before attempting to start the server.
        configuration.logger.debug("Server starting on \(configuration.addressDescription)")
        
        /// Start the actual `HTTPServer`.
        try self.connection.withLockedValue {
            $0 = try HTTPServerConnection.start(
                application: self.application,
                server: self,
                responder: self.responder,
                configuration: configuration,
                on: self.eventLoopGroup
            ).wait()
        }

        /// Overwrite configuration with actual address, if applicable.
        /// They may differ from the provided configuation if port 0 was provided, for example.
        if let localAddress = self.localAddress {
            if let hostname = localAddress.hostname, let port = localAddress.port {
                configuration.address = .hostname(hostname, port: port)
            } else if let pathname = localAddress.pathname {