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
9eb25215
Commit
9eb25215
authored
Jun 22, 2013
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #583 from ianbarber/master
Small stream engine issue and test_monitor tidy up
parents
91bc7408
694543e3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
4 deletions
+13
-4
stream_engine.cpp
src/stream_engine.cpp
+6
-0
test_monitor.cpp
tests/test_monitor.cpp
+7
-4
No files found.
src/stream_engine.cpp
View file @
9eb25215
...
@@ -660,6 +660,12 @@ void zmq::stream_engine_t::mechanism_ready ()
...
@@ -660,6 +660,12 @@ void zmq::stream_engine_t::mechanism_ready ()
msg_t
identity
;
msg_t
identity
;
mechanism
->
peer_identity
(
&
identity
);
mechanism
->
peer_identity
(
&
identity
);
const
int
rc
=
session
->
push_msg
(
&
identity
);
const
int
rc
=
session
->
push_msg
(
&
identity
);
if
(
rc
==
-
1
&&
errno
==
EAGAIN
)
{
// If the write is failing at this stage with
// an EAGAIN the pipe must be being shut down,
// so we can just bail out of the identity set.
return
;
}
errno_assert
(
rc
==
0
);
errno_assert
(
rc
==
0
);
}
}
...
...
tests/test_monitor.cpp
View file @
9eb25215
...
@@ -42,11 +42,13 @@ static bool read_msg(void* s, zmq_event_t& event, std::string& ep)
...
@@ -42,11 +42,13 @@ static bool read_msg(void* s, zmq_event_t& event, std::string& ep)
rc
=
zmq_msg_recv
(
&
msg1
,
s
,
0
);
rc
=
zmq_msg_recv
(
&
msg1
,
s
,
0
);
if
(
rc
==
-
1
&&
zmq_errno
()
==
ETERM
)
if
(
rc
==
-
1
&&
zmq_errno
()
==
ETERM
)
return
true
;
return
true
;
assert
(
rc
!=
-
1
);
assert
(
rc
!=
-
1
);
assert
(
zmq_msg_more
(
&
msg1
)
!=
0
);
assert
(
zmq_msg_more
(
&
msg1
)
!=
0
);
rc
=
zmq_msg_recv
(
&
msg2
,
s
,
0
);
rc
=
zmq_msg_recv
(
&
msg2
,
s
,
0
);
if
(
rc
==
-
1
&&
zmq_errno
()
==
ETERM
)
if
(
rc
==
-
1
&&
zmq_errno
()
==
ETERM
)
return
true
;
return
true
;
assert
(
rc
!=
-
1
);
assert
(
rc
!=
-
1
);
assert
(
zmq_msg_more
(
&
msg2
)
==
0
);
assert
(
zmq_msg_more
(
&
msg2
)
==
0
);
// copy binary data to event struct
// copy binary data to event struct
...
@@ -204,9 +206,6 @@ int main (void)
...
@@ -204,9 +206,6 @@ int main (void)
rc
=
pthread_create
(
&
threads
[
0
],
NULL
,
rep_socket_monitor
,
ctx
);
rc
=
pthread_create
(
&
threads
[
0
],
NULL
,
rep_socket_monitor
,
ctx
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
rc
=
zmq_bind
(
rep
,
addr
.
c_str
());
assert
(
rc
==
0
);
// REQ socket
// REQ socket
req
=
zmq_socket
(
ctx
,
ZMQ_REQ
);
req
=
zmq_socket
(
ctx
,
ZMQ_REQ
);
assert
(
req
);
assert
(
req
);
...
@@ -216,6 +215,11 @@ int main (void)
...
@@ -216,6 +215,11 @@ int main (void)
assert
(
rc
==
0
);
assert
(
rc
==
0
);
rc
=
pthread_create
(
&
threads
[
1
],
NULL
,
req_socket_monitor
,
ctx
);
rc
=
pthread_create
(
&
threads
[
1
],
NULL
,
req_socket_monitor
,
ctx
);
assert
(
rc
==
0
);
assert
(
rc
==
0
);
sleep
(
1
);
// Bind REQ and REP
rc
=
zmq_bind
(
rep
,
addr
.
c_str
());
assert
(
rc
==
0
);
rc
=
zmq_connect
(
req
,
addr
.
c_str
());
rc
=
zmq_connect
(
req
,
addr
.
c_str
());
assert
(
rc
==
0
);
assert
(
rc
==
0
);
...
@@ -271,4 +275,3 @@ int main (void)
...
@@ -271,4 +275,3 @@ int main (void)
return
0
;
return
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