Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
sgxwallet
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董子豪
sgxwallet
Commits
61cf7127
Unverified
Commit
61cf7127
authored
Sep 10, 2021
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-4586 Added concurrentqueue
parent
5319afa7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
20 deletions
+29
-20
ZMQServer.cpp
zmq_src/ZMQServer.cpp
+27
-20
ZMQServer.h
zmq_src/ZMQServer.h
+2
-0
No files found.
zmq_src/ZMQServer.cpp
View file @
61cf7127
...
...
@@ -179,6 +179,15 @@ void ZMQServer::checkForExit() {
}
void
ZMQServer
::
sendMessagesInOutgoingMessageQueueIfAny
()
{
pair
<
Json
::
Value
,
shared_ptr
<
zmq
::
message_t
>>
element
;
// send all items in outgoing queue
while
(
outgoingQueue
.
try_dequeue
(
element
))
{
sendToClient
(
element
.
first
,
element
.
second
);
}
}
void
ZMQServer
::
waitForIncomingAndProcessOutgoingMessages
()
{
zmq_pollitem_t
items
[
1
];
items
[
0
].
socket
=
*
socket
;
...
...
@@ -190,12 +199,8 @@ void ZMQServer::waitForIncomingAndProcessOutgoingMessages() {
checkForExit
();
pollResult
=
zmq_poll
(
items
,
1
,
1
);
pair
<
Json
::
Value
,
shared_ptr
<
zmq
::
message_t
>>
element
;
sendMessagesInOutgoingMessageQueueIfAny
()
;
// send all items in outgoing queue
while
(
outgoingQueue
.
try_dequeue
(
element
))
{
sendToClient
(
element
.
first
,
element
.
second
);
}
}
while
(
pollResult
==
0
);
}
...
...
@@ -280,12 +285,13 @@ void ZMQServer::doOneServerLoop() {
tie
(
msgStr
,
identity
)
=
receiveMessage
();
{
auto
msg
=
ZMQMessage
::
parse
(
msgStr
.
c_str
(),
msgStr
.
size
(),
true
,
checkSignature
,
checkKeyOwnership
);
CHECK_STATE2
(
msg
,
ZMQ_COULD_NOT_PARSE
);
uint64_t
index
=
0
;
if
((
dynamic_pointer_cast
<
BLSSignReqMessage
>
(
msg
))
||
...
...
@@ -305,6 +311,7 @@ void ZMQServer::doOneServerLoop() {
incomingQueue
.
at
(
index
).
enqueue
(
element
);
}
}
catch
(
ExitRequestedException
)
{
throw
;
...
...
zmq_src/ZMQServer.h
View file @
61cf7127
...
...
@@ -95,6 +95,8 @@ public:
void
sendToClient
(
Json
::
Value
&
_result
,
shared_ptr
<
zmq
::
message_t
>&
_identity
);
void
sendMessagesInOutgoingMessageQueueIfAny
();
};
...
...
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