Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Cameo
cameo
Commits
5f44f900
Commit
5f44f900
authored
Dec 13, 2021
by
legoc
Browse files
Removed some functions from ContextZmq
parent
5d0cbe02
Changes
2
Hide whitespace changes
Inline
Side-by-side
cameo-api-cpp/src/base/impl/zmq/ContextZmq.cpp
View file @
5f44f900
...
...
@@ -133,57 +133,4 @@ bool ContextZmq::isAvailable(RequestSocket * socket, int timeout) {
return
false
;
}
void
ContextZmq
::
sendSyncStream
(
RequestSocket
*
socket
,
const
std
::
string
&
name
)
{
try
{
socket
->
requestJSON
(
createSyncStreamRequest
(
name
));
}
catch
(
const
ConnectionTimeout
&
)
{
// The server is not accessible.
}
catch
(...)
{
// Should not happen.
}
}
void
ContextZmq
::
waitForStreamSubscriber
(
zmq
::
socket_t
*
subscriber
,
RequestSocket
*
socket
,
const
std
::
string
&
name
)
{
// Poll subscriber.
zmq_pollitem_t
items
[
1
];
items
[
0
].
socket
=
static_cast
<
void
*>
(
*
subscriber
);
items
[
0
].
fd
=
0
;
items
[
0
].
events
=
ZMQ_POLLIN
;
items
[
0
].
revents
=
0
;
while
(
true
)
{
sendSyncStream
(
socket
,
name
);
// Wait for 100ms.
int
rc
=
zmq
::
poll
(
items
,
1
,
100
);
if
(
rc
!=
0
)
{
break
;
}
}
}
void
ContextZmq
::
waitForSubscriber
(
zmq
::
socket_t
*
subscriber
,
RequestSocket
*
socket
)
{
// Poll subscriber.
zmq_pollitem_t
items
[
1
];
items
[
0
].
socket
=
static_cast
<
void
*>
(
*
subscriber
);
items
[
0
].
fd
=
0
;
items
[
0
].
events
=
ZMQ_POLLIN
;
items
[
0
].
revents
=
0
;
while
(
true
)
{
isAvailable
(
socket
,
100
);
// Wait for 100ms.
int
rc
=
zmq
::
poll
(
items
,
1
,
100
);
if
(
rc
!=
0
)
{
break
;
}
}
}
}
cameo-api-cpp/src/base/impl/zmq/ContextZmq.h
View file @
5f44f900
...
...
@@ -48,9 +48,6 @@ public:
zmq
::
socket_t
*
createRequestSocket
(
const
std
::
string
&
endpoint
);
bool
isAvailable
(
RequestSocket
*
socket
,
int
timeout
);
void
sendSyncStream
(
RequestSocket
*
socket
,
const
std
::
string
&
name
);
void
waitForStreamSubscriber
(
zmq
::
socket_t
*
subscriber
,
RequestSocket
*
socket
,
const
std
::
string
&
name
);
void
waitForSubscriber
(
zmq
::
socket_t
*
subscriber
,
RequestSocket
*
socket
);
private:
std
::
unique_ptr
<
zmq
::
context_t
>
m_context
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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