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

Revert #599 and add new SocketOption KeepInit #600

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions Network/Socket.hs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ module Network.Socket (
SendBuffer,
RecvBuffer,
KeepAlive,
KeepInit,
OOBInline,
TimeToLive,
MaxSegment,
Expand Down
16 changes: 12 additions & 4 deletions Network/Socket/Options.hsc
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ module Network.Socket.Options (
SocketOption(SockOpt
,UnsupportedSocketOption
,AcceptConn,Debug,ReuseAddr,SoDomain,Type,SoProtocol,SoError
,DontRoute,Broadcast,SendBuffer,RecvBuffer,KeepAlive,OOBInline
,TimeToLive,MaxSegment,NoDelay,Cork,Linger,ReusePort
,DontRoute,Broadcast,SendBuffer,RecvBuffer,KeepAlive,KeepInit
,OOBInline,TimeToLive,MaxSegment,NoDelay,Cork,Linger,ReusePort
,RecvLowWater,SendLowWater,RecvTimeOut,SendTimeOut
,UseLoopBack,UserTimeout,IPv6Only
,RecvIPv4TTL,RecvIPv4TOS,RecvIPv4PktInfo
Expand Down Expand Up @@ -77,6 +77,7 @@ socketOptionBijection =
, (SendBuffer, "SendBuffer")
, (RecvBuffer, "RecvBuffer")
, (KeepAlive, "KeepAlive")
, (KeepInit, "KeepInit")
, (OOBInline, "OOBInline")
, (Linger, "Linger")
, (ReusePort, "ReusePort")
Expand Down Expand Up @@ -220,6 +221,15 @@ pattern KeepAlive = SockOpt (#const SOL_SOCKET) (#const SO_KEEPALIVE)
#else
pattern KeepAlive = SockOpt (-1) (-1)
#endif
-- | TCP_KEEPINIT
pattern KeepInit :: SocketOption
#ifdef TCP_KEEPINIT
pattern KeepInit = SockOpt (#const IPPROTO_TCP) (#const TCP_KEEPINIT)
#elif defined(TCP_CONNECTIONTIMEOUT)
pattern KeepInit = SockOpt (#const IPPROTO_TCP) (#const TCP_CONNECTIONTIMEOUT)
#else
pattern KeepInit = SockOpt (-1) (-1)
#endif
-- | SO_OOBINLINE
pattern OOBInline :: SocketOption
#ifdef SO_OOBINLINE
Expand Down Expand Up @@ -299,8 +309,6 @@ pattern NoDelay = SockOpt (-1) (-1)
pattern UserTimeout :: SocketOption
#ifdef TCP_USER_TIMEOUT
pattern UserTimeout = SockOpt (#const IPPROTO_TCP) (#const TCP_USER_TIMEOUT)
#elif defined(TCP_CONNECTIONTIMEOUT)
pattern UserTimeout = SockOpt (#const IPPROTO_TCP) (#const TCP_CONNECTIONTIMEOUT)
#else
pattern UserTimeout = SockOpt (-1) (-1)
#endif
Expand Down
4 changes: 2 additions & 2 deletions tests/Network/SocketSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@
cmsgidGen = biasedGen (\g -> CmsgId <$> g <*> g) cmsgidPatterns arbitrary

genFds :: Gen [Fd]
genFds = listOf (Fd <$> arbitrary)

Check warning on line 426 in tests/Network/SocketSpec.hs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 9.4)

Defined but not used: ‘genFds’

Check warning on line 426 in tests/Network/SocketSpec.hs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 9.4)

Defined but not used: ‘genFds’

Check warning on line 426 in tests/Network/SocketSpec.hs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 9.6)

Defined but not used: ‘genFds’

Check warning on line 426 in tests/Network/SocketSpec.hs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 9.6)

Defined but not used: ‘genFds’

Check warning on line 426 in tests/Network/SocketSpec.hs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 9.8)

Defined but not used: ‘genFds’

Check warning on line 426 in tests/Network/SocketSpec.hs

View workflow job for this annotation

GitHub Actions / build (windows-latest, 9.8)

Defined but not used: ‘genFds’

-- pruned lists of pattern synonym values for each type to generate values from

Expand Down Expand Up @@ -456,8 +456,8 @@
sockoptPatterns = nub
[UnsupportedSocketOption
,Debug,ReuseAddr,SoDomain,Type,SoProtocol,SoError,DontRoute
,Broadcast,SendBuffer,RecvBuffer,KeepAlive,OOBInline,TimeToLive
,MaxSegment,NoDelay,Cork,Linger,ReusePort
,Broadcast,SendBuffer,RecvBuffer,KeepAlive,KeepInit,OOBInline
,TimeToLive,MaxSegment,NoDelay,Cork,Linger,ReusePort
,RecvLowWater,SendLowWater,RecvTimeOut,SendTimeOut
,UseLoopBack,UserTimeout,IPv6Only
,RecvIPv4TTL,RecvIPv4TOS,RecvIPv4PktInfo
Expand Down
Loading