Skip to content

Commit

Permalink
swap port to correct port order (nim-lang#19177)
Browse files Browse the repository at this point in the history
Co-authored-by: Jaremy Creechley <[email protected]>
  • Loading branch information
2 people authored and PMunch committed Mar 28, 2022
1 parent b284208 commit 06a356c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/pure/net.nim
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,14 @@ proc toSockAddr*(address: IpAddress, port: Port, sa: var Sockaddr_storage,
sl = sizeof(Sockaddr_in).SockLen
let s = cast[ptr Sockaddr_in](addr sa)
s.sin_family = typeof(s.sin_family)(toInt(AF_INET))
s.sin_port = port
s.sin_port = htons(port)
copyMem(addr s.sin_addr, unsafeAddr address.address_v4[0],
sizeof(s.sin_addr))
of IpAddressFamily.IPv6:
sl = sizeof(Sockaddr_in6).SockLen
let s = cast[ptr Sockaddr_in6](addr sa)
s.sin6_family = typeof(s.sin6_family)(toInt(AF_INET6))
s.sin6_port = port
s.sin6_port = htons(port)
copyMem(addr s.sin6_addr, unsafeAddr address.address_v6[0],
sizeof(s.sin6_addr))

Expand Down

0 comments on commit 06a356c

Please sign in to comment.