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
a6cfbca3
Unverified
Commit
a6cfbca3
authored
May 23, 2018
by
Luca Boccassi
Committed by
GitHub
May 23, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3128 from sigiesec/fix-test-inproc-connect
Problem: test_context_socket is not thread-safe
parents
01395829
64f2b100
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
test_inproc_connect.cpp
tests/test_inproc_connect.cpp
+9
-6
No files found.
tests/test_inproc_connect.cpp
View file @
a6cfbca3
...
...
@@ -43,7 +43,8 @@ void tearDown ()
static
void
pusher
(
void
*
/*unused*/
)
{
// Connect first
void
*
connectSocket
=
test_context_socket
(
ZMQ_PAIR
);
// do not use test_context_socket here, as it is not thread-safe
void
*
connectSocket
=
zmq_socket
(
get_test_context
(),
ZMQ_PAIR
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
connectSocket
,
"inproc://sink"
));
...
...
@@ -51,7 +52,7 @@ static void pusher (void * /*unused*/)
send_string_expect_success
(
connectSocket
,
"foobar"
,
0
);
// Cleanup
test_context_socket_close
(
connectSocket
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_close
(
connectSocket
)
);
}
static
void
simult_conn
(
void
*
endpt_
)
...
...
@@ -60,11 +61,12 @@ static void simult_conn (void *endpt_)
const
char
*
endpt
=
static_cast
<
const
char
*>
(
endpt_
);
// Connect
void
*
connectSocket
=
test_context_socket
(
ZMQ_SUB
);
// do not use test_context_socket here, as it is not thread-safe
void
*
connectSocket
=
zmq_socket
(
get_test_context
(),
ZMQ_SUB
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_connect
(
connectSocket
,
endpt
));
// Cleanup
test_context_socket_close
(
connectSocket
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_close
(
connectSocket
)
);
}
static
void
simult_bind
(
void
*
endpt_
)
...
...
@@ -73,11 +75,12 @@ static void simult_bind (void *endpt_)
const
char
*
endpt
=
static_cast
<
const
char
*>
(
endpt_
);
// Bind
void
*
bindSocket
=
test_context_socket
(
ZMQ_PUB
);
// do not use test_context_socket here, as it is not thread-safe
void
*
bindSocket
=
zmq_socket
(
get_test_context
(),
ZMQ_PUB
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_bind
(
bindSocket
,
endpt
));
// Cleanup
test_context_socket_close
(
bindSocket
);
TEST_ASSERT_SUCCESS_ERRNO
(
zmq_close
(
bindSocket
)
);
}
void
test_bind_before_connect
()
...
...
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