Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add setTcpAcceptFilter.

  • Loading branch information...
commit f538bf5000e88c19087161610c63c741d35bdabf 1 parent a566709
@twittner authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/System/ZMQ3.hs
View
14 src/System/ZMQ3.hs
@@ -175,7 +175,7 @@ module System.ZMQ3 (
, setSendBuffer
, setSendHighWM
, setSendTimeout
--- , setTcpAcceptFilter
+ , setTcpAcceptFilter
, setTcpKeepAlive
, setTcpKeepAliveCount
, setTcpKeepAliveIdle
@@ -644,6 +644,18 @@ setReceiveHighWM = setInt32OptFromRestricted B.receiveHighWM
setSendHighWM :: Integral i => Restricted N0 Int32 i -> Socket a -> IO ()
setSendHighWM = setInt32OptFromRestricted B.sendHighWM
+-- | Cf. @zmq_setsockopt ZMQ_TCP_ACCEPT_FILTER@
+setTcpAcceptFilter :: Maybe String -> Socket a -> IO ()
+setTcpAcceptFilter Nothing sock = onSocket "setTcpAcceptFilter" sock $ \s ->
+ throwIfMinus1Retry_ "setStrOpt" $
+ c_zmq_setsockopt s (optVal tcpAcceptFilter) nullPtr 0
+setTcpAcceptFilter (Just dat) sock = onSocket "setTcpAcceptFilter" sock $ \s ->
+ throwIfMinus1Retry_ "setStrOpt" $
+ withCStringLen dat $ \(ptr, len) ->
+ c_zmq_setsockopt s (optVal tcpAcceptFilter)
+ (castPtr ptr)
+ (fromIntegral len)
+
-- | Cf. @zmq_setsockopt ZMQ_TCP_KEEPALIVE@
setTcpKeepAlive :: Switch -> Socket a -> IO ()
setTcpKeepAlive x s = setIntOpt s B.tcpKeepAlive (fromSwitch x :: CInt)

0 comments on commit f538bf5

Please sign in to comment.
Something went wrong with that request. Please try again.