Skip to content

Commit

Permalink
Add immediate property to sockets (#209)
Browse files Browse the repository at this point in the history
This allows the setting of the sockopt `ZMQ_IMMEDIATE`, which allows for
more reliable message passing when dealing with round-robin style
sockets such as a `DEALER` socket.  See the man page for setsockopt for
more information: http://api.zeromq.org/master:zmq-setsockopt
  • Loading branch information
staticfloat authored Feb 11, 2021
1 parent cf2b7a4 commit b522081
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/sockopts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ for (fset, fget, k, T) in [
(:set_tcp_keepalive_intvl, :get_tcp_keepalive_intvl, 37, Cint)
(:set_rcvtimeo, :get_rcvtimeo, 27, Cint)
(:set_sndtimeo, :get_sndtimeo, 28, Cint)
(:set_immediate, :get_immediate, 39, Cint)
(nothing, :get_fd, 14, Sys.iswindows() ? Ptr{Cvoid} : Cint)
]
if fset != nothing
Expand Down Expand Up @@ -121,7 +122,7 @@ const sockprops = (:affinity, :type, :linger, :reconnect_ivl, :backlog, :reconne
:rate, :recovery_ivl, :sndbuf, :rcvbuf, :rcvmore, :events, :maxmsgsize,
:sndhwm, :rcvhwm, :multicast_hops, :ipv4only,
:tcp_keepalive, :tcp_keepalive_idle, :tcp_keepalive_cnt, :tcp_keepalive_intvl,
:rcvtimeo, :sndtimeo, :fd, :routing_id, :last_endpoint)
:rcvtimeo, :sndtimeo, :fd, :routing_id, :last_endpoint, :immediate)

Base.propertynames(::Socket) = sockprops
@eval function Base.getproperty(value::Socket, name::Symbol)
Expand All @@ -134,4 +135,4 @@ end
:($(Symbol("_set_", p))(value, x))
end)
return x
end
end

0 comments on commit b522081

Please sign in to comment.