Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xlc committed Oct 21, 2024
1 parent d2024ec commit d0ab1fa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions Networking/Sources/MsQuicSwift/NetAddr.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ private func parseIpv6Addr(_ address: String) -> (String, UInt16)? {
}

private func parseIpv4Addr(_ address: String) -> (String, UInt16)? {
print(address)
let parts = address.split(separator: ":")
guard parts.count == 2 else {
return nil
Expand Down
11 changes: 7 additions & 4 deletions Networking/Tests/MsQuicSwiftTests/QuicListenerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ struct QuicListenerTests {
handler: serverHandler,
registration: registration,
configuration: serverConfiguration,
listenAddress: NetAddr(ipAddress: "127.0.0.1", port: 0),
listenAddress: NetAddr(ipAddress: "127.0.0.1", port: 0)!,
alpns: [Data("testalpn".utf8)]
)

let listenAddress = try listener.listenAddress()
#expect(listenAddress.ipAddress == "127.0.0.1")
#expect(listenAddress.port != 0)
let (ipAddress, port) = listenAddress.getAddressAndPort()
#expect(ipAddress == "127.0.0.1")
#expect(port != 0)

// create connection to listener

Expand Down Expand Up @@ -82,10 +83,12 @@ struct QuicListenerTests {
}
}.first!

let (ipAddress2, _) = info.remoteAddress.getAddressAndPort()

#expect(info.negotiatedAlpn == Data("testalpn".utf8))
#expect(info.serverName == "127.0.0.1")
#expect(info.localAddress == listenAddress)
#expect(info.remoteAddress.ipAddress == "127.0.0.1")
#expect(ipAddress2 == "127.0.0.1")

let stream2 = try serverConnection.createStream()
try stream2.send(data: Data("other test data 2".utf8))
Expand Down
2 changes: 1 addition & 1 deletion Networking/Tests/NetworkingTests/PKCS12Tests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct PKCS12Tests {
handler: serverHandler,
registration: registration,
configuration: serverConfiguration,
listenAddress: NetAddr(ipAddress: "127.0.0.1", port: 0),
listenAddress: NetAddr(ipAddress: "127.0.0.1", port: 0)!,
alpns: [Data("testalpn".utf8)]
)

Expand Down

0 comments on commit d0ab1fa

Please sign in to comment.