Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions FlyingSocks/Sources/Socket+WinSock2.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,24 +107,6 @@ extension Socket {
return addr
}

static func makeAbstractNamespaceUnix(name: String) -> WinSDK.sockaddr_un {
var addr: sockaddr_un = WinSDK.sockaddr_un()
addr.sun_family = ADDRESS_FAMILY(AF_UNIX)

_ = withUnsafeMutableBytes(of: &addr.sun_path) { raw in
raw.initializeMemory(as: CChar.self, repeating: 0)
}

let nameBytes = Array(name.utf8.prefix(107))
nameBytes.withUnsafeBytes { src in
withUnsafeMutableBytes(of: &addr.sun_path) { dst in
dst[1 ..< 1 + src.count].copyBytes(from: src)
}
}

return addr
}

static func fcntl(_ fd: FileDescriptorType, _ cmd: Int32) -> Int32 {
return -1
}
Expand Down
2 changes: 1 addition & 1 deletion FlyingSocks/Sources/SocketAddress.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public extension SocketAddress where Self == sockaddr_un {
Socket.makeAddressUnix(path: path)
}

#if canImport(Glibc) || canImport(Musl) || canImport(Android) || canImport(WinSDK)
#if canImport(Glibc) || canImport(Musl) || canImport(Android)
static func unix(abstractNamespace: String) -> Self {
Socket.makeAbstractNamespaceUnix(name: abstractNamespace)
}
Expand Down
4 changes: 2 additions & 2 deletions FlyingSocks/Tests/SocketAddressTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ struct SocketAddressTests {
)
}

#if canImport(Glibc) || canImport(Musl) || canImport(Android) || canImport(WinSDK)
#if canImport(Glibc) || canImport(Musl) || canImport(Android)
@Test
func unixAbstractNamespace_IsCorrectlyDecodedFromStorage() throws {
let storage = sockaddr_un
Expand Down Expand Up @@ -200,7 +200,7 @@ struct SocketAddressTests {
)
}

#if canImport(Glibc) || canImport(Musl) || canImport(Android) || canImport(WinSDK)
#if canImport(Glibc) || canImport(Musl) || canImport(Android)
@Test
func unixAbstractNamespace_CheckSize() throws {
let sun = sockaddr_un.unix(abstractNamespace: "some_great_namespace")
Expand Down
Loading