Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the missing socket options for 32-bit. #1918

Merged
merged 4 commits into from
Jul 26, 2021
Merged
Changes from 1 commit
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
Next Next commit
Fix the missing socket options for 32-bit.
Motivation:

When pulling out the NIOBSDSocket later in #1907 we dropped some of the
socket option fixes for 32 bit platforms, which broke them.

Modifications:

Restore the socket options.

Result:

32-bit build should be working again.
  • Loading branch information
Lukasa committed Jul 26, 2021
commit 754a375579852014a8880ab4a261c239915be8c5
9 changes: 9 additions & 0 deletions Sources/NIOCore/BSDSocketAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ private let sysInet_ntop: @convention(c) (CInt, UnsafeRawPointer?, UnsafeMutable
private let sysInet_pton: @convention(c) (CInt, UnsafePointer<CChar>?, UnsafeMutableRawPointer?) -> CInt = inet_pton
#endif

// Work around SO_TIMESTAMP/SO_RCVTIMEO being awkwardly defined in glibc.
#if os(Android) && arch(arm)
let SO_RCVTIMEO = SO_RCVTIMEO_OLD
let SO_TIMESTAMP = SO_TIMESTAMP_OLD
#elseif os(Linux)
let SO_TIMESTAMP = CNIOLinux_SO_TIMESTAMP
Lukasa marked this conversation as resolved.
Show resolved Hide resolved
let SO_RCVTIMEO = CNIOLinux_SO_RCVTIMEO
#endif

public enum NIOBSDSocket {
#if os(Windows)
public typealias Handle = SOCKET
Expand Down