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 <jaremy.creechley@panthalassa.com>
  • Loading branch information
elcritch and Jaremy Creechley authored Nov 24, 2021
1 parent f91867a commit 0d0c249
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 0d0c249

Please sign in to comment.