Skip to content

Commit

Permalink
Setting the listenerDescription right
Browse files Browse the repository at this point in the history
  • Loading branch information
Pushkar N Kulkarni committed Mar 30, 2019
1 parent f04d4eb commit 450882a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Sources/KituraNet/HTTP/HTTPServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -308,19 +308,20 @@ public class HTTPServer: Server {
do {
switch socket {
case SocketType.tcp(let port):
listenerDescription = "port \(port)"
serverChannel = try bootstrap.bind(host: "0.0.0.0", port: port).wait()
self.port = serverChannel?.localAddress?.port.map { Int($0) }
listenerDescription = "port \(self.port)"
case SocketType.unix(let unixDomainSocketPath):
listenerDescription = "path \(unixDomainSocketPath)"
// Ensure the path doesn't exist...
#if os(Linux)
_ = Glibc.unlink(unixDomainSocketPath)
#else
_ = Darwin.unlink(unixDomainSocketPath)
#endif
serverChannel = try bootstrap.bind(unixDomainSocketPath: unixDomainSocketPath).wait()
self.unixDomainSocketPath = unixDomainSocketPath
listenerDescription = "path \(unixDomainSocketPath)"
}
self.port = serverChannel?.localAddress?.port.map { Int($0) }
self.state = .started
self.lifecycleListener.performStartCallbacks()
} catch let error {
Expand Down

0 comments on commit 450882a

Please sign in to comment.