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
f575911f
Unverified
Commit
f575911f
authored
Sep 07, 2021
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SKALE-4586 Added Thread Pool
parent
150b2cda
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
+18
-6
ZMQServer.cpp
zmq_src/ZMQServer.cpp
+18
-6
No files found.
zmq_src/ZMQServer.cpp
View file @
f575911f
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "SGXException.h"
#include "SGXException.h"
#include "ExitRequestedException.h"
#include "ExitRequestedException.h"
#include "ReqMessage.h"
#include "ZMQMessage.h"
#include "ZMQMessage.h"
#include "ZMQServer.h"
#include "ZMQServer.h"
#include "sgxwallet_common.h"
#include "sgxwallet_common.h"
...
@@ -199,6 +200,7 @@ void ZMQServer::doOneServerLoop() {
...
@@ -199,6 +200,7 @@ void ZMQServer::doOneServerLoop() {
}
while
(
pollResult
==
0
);
}
while
(
pollResult
==
0
);
if
(
!
socket
->
recv
(
&
identity
))
{
if
(
!
socket
->
recv
(
&
identity
))
{
checkForExit
();
// something terrible happened
// something terrible happened
spdlog
::
error
(
"Fatal error: socket->recv(&identity) returned false. Exiting."
);
spdlog
::
error
(
"Fatal error: socket->recv(&identity) returned false. Exiting."
);
exit
(
-
11
);
exit
(
-
11
);
...
@@ -213,6 +215,7 @@ void ZMQServer::doOneServerLoop() {
...
@@ -213,6 +215,7 @@ void ZMQServer::doOneServerLoop() {
zmq
::
message_t
reqMsg
;
zmq
::
message_t
reqMsg
;
if
(
!
socket
->
recv
(
&
reqMsg
,
0
))
{
if
(
!
socket
->
recv
(
&
reqMsg
,
0
))
{
checkForExit
();
// something terrible happened
// something terrible happened
spdlog
::
error
(
"Fatal error: socket.recv(&reqMsg, 0) returned false. Exiting"
);
spdlog
::
error
(
"Fatal error: socket.recv(&reqMsg, 0) returned false. Exiting"
);
exit
(
-
13
);
exit
(
-
13
);
...
@@ -226,6 +229,16 @@ void ZMQServer::doOneServerLoop() {
...
@@ -226,6 +229,16 @@ void ZMQServer::doOneServerLoop() {
auto
parsedMsg
=
ZMQMessage
::
parse
(
auto
parsedMsg
=
ZMQMessage
::
parse
(
stringToParse
.
c_str
(),
stringToParse
.
size
(),
true
,
checkSignature
,
checkKeyOwnership
);
stringToParse
.
c_str
(),
stringToParse
.
size
(),
true
,
checkSignature
,
checkKeyOwnership
);
if
((
dynamic_pointer_cast
<
BLSSignReqMessage
>
(
parsedMsg
)
!=
nullptr
)
||
dynamic_pointer_cast
<
ECDSASignReqMessage
>
(
parsedMsg
))
{
spdlog
::
info
(
"FUFUFUFUF"
);
}
else
{
spdlog
::
info
(
"HAHAHA"
);
}
CHECK_STATE2
(
parsedMsg
,
ZMQ_COULD_NOT_PARSE
);
CHECK_STATE2
(
parsedMsg
,
ZMQ_COULD_NOT_PARSE
);
...
@@ -233,11 +246,13 @@ void ZMQServer::doOneServerLoop() {
...
@@ -233,11 +246,13 @@ void ZMQServer::doOneServerLoop() {
}
catch
(
ExitRequestedException
)
{
}
catch
(
ExitRequestedException
)
{
throw
;
throw
;
}
catch
(
std
::
exception
&
e
)
{
}
catch
(
std
::
exception
&
e
)
{
checkForExit
();
result
[
"errorMessage"
]
=
string
(
e
.
what
());
result
[
"errorMessage"
]
=
string
(
e
.
what
());
spdlog
::
error
(
"Exception in zmq server :{}"
,
e
.
what
());
spdlog
::
error
(
"Exception in zmq server :{}"
,
e
.
what
());
spdlog
::
error
(
"ID:"
+
string
((
char
*
)
identity
.
data
(),
identity
.
size
()));
spdlog
::
error
(
"ID:"
+
string
((
char
*
)
identity
.
data
(),
identity
.
size
()));
spdlog
::
error
(
"Client request :"
+
stringToParse
);
spdlog
::
error
(
"Client request :"
+
stringToParse
);
}
catch
(...)
{
}
catch
(...)
{
checkForExit
();
spdlog
::
error
(
"Error in zmq server "
);
spdlog
::
error
(
"Error in zmq server "
);
result
[
"errorMessage"
]
=
"Error in zmq server "
;
result
[
"errorMessage"
]
=
"Error in zmq server "
;
spdlog
::
error
(
"ID:"
+
string
((
char
*
)
identity
.
data
(),
identity
.
size
()));
spdlog
::
error
(
"ID:"
+
string
((
char
*
)
identity
.
data
(),
identity
.
size
()));
...
@@ -255,23 +270,20 @@ void ZMQServer::doOneServerLoop() {
...
@@ -255,23 +270,20 @@ void ZMQServer::doOneServerLoop() {
CHECK_STATE
(
replyStr
.
back
()
==
'}'
);
CHECK_STATE
(
replyStr
.
back
()
==
'}'
);
if
(
!
socket
->
send
(
identity
,
ZMQ_SNDMORE
))
{
if
(
!
socket
->
send
(
identity
,
ZMQ_SNDMORE
))
{
if
(
isExitRequested
)
{
return
;
}
exit
(
-
15
);
exit
(
-
15
);
}
}
if
(
!
s_send
(
*
socket
,
replyStr
))
{
if
(
!
s_send
(
*
socket
,
replyStr
))
{
if
(
isExitRequested
)
{
return
;
}
exit
(
-
16
);
exit
(
-
16
);
}
}
}
catch
(
ExitRequestedException
)
{
}
catch
(
ExitRequestedException
)
{
throw
;
throw
;
}
catch
(
std
::
exception
&
e
)
{
}
catch
(
std
::
exception
&
e
)
{
checkForExit
();
spdlog
::
error
(
"Exception in zmq server worker send :{}"
,
e
.
what
());
spdlog
::
error
(
"Exception in zmq server worker send :{}"
,
e
.
what
());
exit
(
-
17
);
exit
(
-
17
);
}
catch
(...)
{
}
catch
(...)
{
checkForExit
();
spdlog
::
error
(
"Unklnown exception in zmq server worker send"
);
spdlog
::
error
(
"Unklnown exception in zmq server worker send"
);
exit
(
-
18
);
exit
(
-
18
);
}
}
...
...
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