Skip to content

Commit

Permalink
Added if check to determine swift version and OS in channelRead on St…
Browse files Browse the repository at this point in the history
…unInboundHandler for determining proper address property in sin6_addr C lib
  • Loading branch information
Cartisim committed Jan 22, 2022
1 parent 41cc48e commit fdeab9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
xcuserdata/
DerivedData/
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.vscode/
6 changes: 5 additions & 1 deletion Sources/Dribble/StunInboundHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ final class StunInboundHandler: ChannelInboundHandler, StunMessageSender {
case (.v4(let lhs), .v4(let rhs)):
return lhs.address.sin_addr.s_addr == rhs.address.sin_addr.s_addr
case (.v6(let lhs), .v6(let rhs)):
return lhs.address.sin6_addr.__u6_addr.__u6_addr32 == rhs.address.sin6_addr.__u6_addr.__u6_addr32
#if swift(>=5.5) && os(Linux)
return lhs.address.sin6_addr.__in6_u.__u6_addr32 == rhs.address.sin6_addr.__in6_u.__u6_addr32
#else
return lhs.address.sin6_addr.__u6_addr.__u6_addr32 == rhs.address.sin6_addr.__u6_addr.__u6_addr32
#endif
case (.v4, _), (.v6, _), (.unixDomainSocket, _),
(_, .v4), (_, .v6), (_, .unixDomainSocket):
return false
Expand Down

0 comments on commit fdeab9c

Please sign in to comment.