Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
749c391b
Commit
749c391b
authored
Aug 03, 2013
by
Ian Barber
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #622 from ckamm/req-strict
Rename ZMQ_REQ_SEND_RESETS -> ZMQ_REQ_STRICT.
parents
fe30cc6d
423ca36b
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
22 additions
and
20 deletions
+22
-20
.gitignore
.gitignore
+1
-1
zmq_setsockopt.txt
doc/zmq_setsockopt.txt
+8
-7
zmq.h
include/zmq.h
+1
-1
req.cpp
src/req.cpp
+5
-5
req.hpp
src/req.hpp
+2
-2
Makefile.am
tests/Makefile.am
+2
-2
test_req_strict.cpp
tests/test_req_strict.cpp
+3
-2
No files found.
.gitignore
View file @
749c391b
...
...
@@ -59,7 +59,7 @@ tests/test_spec_rep
tests/test_spec_req
tests/test_spec_router
tests/test_req_request_ids
tests/test_req_s
end_resets
tests/test_req_s
trict
src/platform.hpp*
src/stamp-h1
perf/local_lat
...
...
doc/zmq_setsockopt.txt
View file @
749c391b
...
...
@@ -14,7 +14,8 @@ SYNOPSIS
Caution: All options, with the exception of ZMQ_SUBSCRIBE, ZMQ_UNSUBSCRIBE,
ZMQ_LINGER, ZMQ_ROUTER_MANDATORY, ZMQ_PROBE_ROUTER, ZMQ_XPUB_VERBOSE,
ZMQ_REQ_SEND_RESETS only take effect for subsequent socket bind/connects.
ZMQ_REQ_STRICT, ZMQ_REQ_REQUEST_IDS only take effect for subsequent socket
bind/connects.
Specifically, security options take effect for subsequent binds/connects and can be
changed at any time to affect subsequent binds and/or connects.
...
...
@@ -476,25 +477,25 @@ Default value:: 0
Applicable socket types:: ZMQ_REQ
ZMQ_REQ_S
END_RESETS: reset request-reply sequence by sending another message
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~
ZMQ_REQ_S
TRICT: enforce strict alternation between request and reply
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When set to
0
, a REQ socket does not allow initiating a new request with
When set to
1
, a REQ socket does not allow initiating a new request with
_zmq_send(3)_ until the reply to the previous one has been received.
When set to
1
, sending another message is allowed and has the effect of
When set to
0
, sending another message is allowed and has the effect of
disconnecting the underlying connection to the peer from which the reply was
expected, triggering a reconnection attempt on transports that support it.
The request-reply state machine is reset and a new request is sent to the
next available peer.
When this option is enabled
, also enable ZMQ_REQ_REQUEST_IDS to ensure correct
If set to 0
, also enable ZMQ_REQ_REQUEST_IDS to ensure correct
matching of requests and replies. Otherwise a late reply to an aborted request
can be reported as the reply to the superseding request.
[horizontal]
Option value type:: int
Option value unit:: 0, 1
Default value::
0
Default value::
1
Applicable socket types:: ZMQ_REQ
...
...
include/zmq.h
View file @
749c391b
...
...
@@ -277,7 +277,7 @@ ZMQ_EXPORT int zmq_msg_set (zmq_msg_t *msg, int option, int optval);
#define ZMQ_CURVE_SERVERKEY 50
#define ZMQ_PROBE_ROUTER 51
#define ZMQ_REQ_REQUEST_IDS 52
#define ZMQ_REQ_S
END_RESETS
53
#define ZMQ_REQ_S
TRICT
53
/* Message options */
#define ZMQ_MORE 1
...
...
src/req.cpp
View file @
749c391b
...
...
@@ -31,7 +31,7 @@ zmq::req_t::req_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
reply_pipe
(
NULL
),
request_id_frames_enabled
(
false
),
request_id
(
generate_random
()),
s
end_resets
(
fals
e
)
s
trict
(
tru
e
)
{
options
.
type
=
ZMQ_REQ
;
}
...
...
@@ -43,9 +43,9 @@ zmq::req_t::~req_t ()
int
zmq
::
req_t
::
xsend
(
msg_t
*
msg_
)
{
// If we've sent a request and we still haven't got the reply,
// we can't send another request unless the s
end_resets option is en
abled.
// we can't send another request unless the s
trict option is dis
abled.
if
(
receiving_reply
)
{
if
(
!
send_resets
)
{
if
(
strict
)
{
errno
=
EFSM
;
return
-
1
;
}
...
...
@@ -205,9 +205,9 @@ int zmq::req_t::xsetsockopt (int option_, const void *optval_, size_t optvallen_
}
break
;
case
ZMQ_REQ_S
END_RESETS
:
case
ZMQ_REQ_S
TRICT
:
if
(
is_int
&&
value
>=
0
)
{
s
end_resets
=
value
;
s
trict
=
value
;
return
0
;
}
break
;
...
...
src/req.hpp
View file @
749c391b
...
...
@@ -72,10 +72,10 @@ namespace zmq
// request is sent.
uint32_t
request_id
;
// If
tru
e, send() will reset its internal state and terminate the
// If
fals
e, send() will reset its internal state and terminate the
// reply_pipe's connection instead of failing if a previous request is
// still pending.
bool
s
end_resets
;
bool
s
trict
;
req_t
(
const
req_t
&
);
const
req_t
&
operator
=
(
const
req_t
&
);
...
...
tests/Makefile.am
View file @
749c391b
...
...
@@ -31,7 +31,7 @@ noinst_PROGRAMS = test_pair_inproc \
test_spec_router
\
test_spec_pushpull
\
test_req_request_ids
\
test_req_s
end_resets
test_req_s
trict
if
!ON_MINGW
noinst_PROGRAMS
+=
test_shutdown_stress
\
...
...
@@ -68,7 +68,7 @@ test_spec_dealer_SOURCES = test_spec_dealer.cpp
test_spec_router_SOURCES
=
test_spec_router.cpp
test_spec_pushpull_SOURCES
=
test_spec_pushpull.cpp
test_req_request_ids_SOURCES
=
test_req_request_ids.cpp
test_req_s
end_resets_SOURCES
=
test_req_send_resets
.cpp
test_req_s
trict_SOURCES
=
test_req_strict
.cpp
if
!ON_MINGW
test_shutdown_stress_SOURCES
=
test_shutdown_stress.cpp
test_pair_ipc_SOURCES
=
test_pair_ipc.cpp testutil.hpp
...
...
tests/test_req_s
end_resets
.cpp
→
tests/test_req_s
trict
.cpp
View file @
749c391b
...
...
@@ -30,10 +30,11 @@ int main (void)
void
*
req
=
zmq_socket
(
ctx
,
ZMQ_REQ
);
assert
(
req
);
int
enabled
=
1
;
int
rc
=
zmq_setsockopt
(
req
,
ZMQ_REQ_S
END_RESETS
,
&
en
abled
,
sizeof
(
int
));
int
disabled
=
0
;
int
rc
=
zmq_setsockopt
(
req
,
ZMQ_REQ_S
TRICT
,
&
dis
abled
,
sizeof
(
int
));
assert
(
rc
==
0
);
int
enabled
=
1
;
rc
=
zmq_setsockopt
(
req
,
ZMQ_REQ_REQUEST_IDS
,
&
enabled
,
sizeof
(
int
));
assert
(
rc
==
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment