Skip to content

Commit

Permalink
Socket Domain Type
Browse files Browse the repository at this point in the history
  • Loading branch information
swhitty committed Feb 20, 2022
1 parent 15205b9 commit 01e6ddc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/HTTPServer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public final actor HTTPServer {
}

public func start() async throws {
let socket = try Socket()
let socket = try Socket(domain: AF_INET6, type: Socket.stream)
try socket.setOption(.enableLocalAddressReuse)
#if canImport(Darwin)
try socket.setOption(.enableNoSIGPIPE)
Expand Down
4 changes: 2 additions & 2 deletions Sources/Socket/Socket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ struct Socket: Sendable, Hashable {
self.file = file
}

init() throws {
self.file = Socket.socket(AF_INET6, Socket.stream, 0)
init(domain: Int32, type: Int32) throws {
self.file = Socket.socket(domain, type, 0)
if file == -1 {
throw SocketError.makeFailed("CreateSocket")
}
Expand Down

0 comments on commit 01e6ddc

Please sign in to comment.