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
92137b06
Unverified
Commit
92137b06
authored
Jan 19, 2021
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug/SKALE-3751-enable-zeromq
parent
89a789c1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
15 deletions
+22
-15
ServerInit.cpp
ServerInit.cpp
+5
-11
ZMQServer.cpp
ZMQServer.cpp
+8
-0
ZMQServer.h
ZMQServer.h
+4
-0
testw.cpp
testw.cpp
+5
-4
No files found.
ServerInit.cpp
View file @
92137b06
...
@@ -88,7 +88,7 @@ void systemHealthCheck() {
...
@@ -88,7 +88,7 @@ void systemHealthCheck() {
}
}
}
}
static
ZMQServer
*
zmqServer
=
nullptr
;
void
initUserSpace
()
{
void
initUserSpace
()
{
...
@@ -107,12 +107,6 @@ void initUserSpace() {
...
@@ -107,12 +107,6 @@ void initUserSpace() {
}
}
void
exitZMQServer
()
{
spdlog
::
info
(
"Exiting zmq server ..."
);
zmqServer
->
exitWorkers
();
spdlog
::
info
(
"Exited zmq server ..."
);
zmqServer
=
nullptr
;
}
uint64_t
initEnclave
()
{
uint64_t
initEnclave
()
{
...
@@ -210,14 +204,14 @@ void initAll(uint32_t _logLevel, bool _checkCert, bool _autoSign, bool _generate
...
@@ -210,14 +204,14 @@ void initAll(uint32_t _logLevel, bool _checkCert, bool _autoSign, bool _generate
SGXWalletServer
::
initHttpsServer
(
_checkCert
);
SGXWalletServer
::
initHttpsServer
(
_checkCert
);
SGXRegistrationServer
::
initRegistrationServer
(
_autoSign
);
SGXRegistrationServer
::
initRegistrationServer
(
_autoSign
);
CSRManagerServer
::
initCSRManagerServer
();
CSRManagerServer
::
initCSRManagerServer
();
zmqServer
=
new
ZMQServer
();
ZMQServer
::
zmqServer
=
new
ZMQServer
();
static
std
::
thread
serverThread
(
std
::
bind
(
&
ZMQServer
::
run
,
zmqServer
));
static
std
::
thread
serverThread
(
std
::
bind
(
&
ZMQServer
::
run
,
ZMQServer
::
zmqServer
));
serverThread
.
detach
();
serverThread
.
detach
();
}
else
{
}
else
{
SGXWalletServer
::
initHttpServer
();
SGXWalletServer
::
initHttpServer
();
zmqServer
=
new
ZMQServer
();
ZMQServer
::
zmqServer
=
new
ZMQServer
();
static
std
::
thread
serverThread
(
std
::
bind
(
&
ZMQServer
::
run
,
zmqServer
));
static
std
::
thread
serverThread
(
std
::
bind
(
&
ZMQServer
::
run
,
ZMQServer
::
zmqServer
));
serverThread
.
detach
();
serverThread
.
detach
();
}
}
SGXInfoServer
::
initInfoServer
(
_logLevel
,
_checkCert
,
_autoSign
,
_generateTestKeys
);
SGXInfoServer
::
initInfoServer
(
_logLevel
,
_checkCert
,
_autoSign
,
_generateTestKeys
);
...
...
ZMQServer.cpp
View file @
92137b06
...
@@ -30,6 +30,8 @@
...
@@ -30,6 +30,8 @@
using
namespace
std
;
using
namespace
std
;
ZMQServer
*
ZMQServer
::
zmqServer
=
nullptr
;
ZMQServer
::
ZMQServer
()
ZMQServer
::
ZMQServer
()
:
isExitRequested
(
false
),
ctx_
(
make_shared
<
zmq
::
context_t
>
(
1
)),
:
isExitRequested
(
false
),
ctx_
(
make_shared
<
zmq
::
context_t
>
(
1
)),
frontend_
(
*
ctx_
,
ZMQ_ROUTER
),
frontend_
(
*
ctx_
,
ZMQ_ROUTER
),
...
@@ -141,3 +143,9 @@ void ZMQServer::exitWorkers() {
...
@@ -141,3 +143,9 @@ void ZMQServer::exitWorkers() {
}
}
void
ZMQServer
::
exitZMQServer
()
{
spdlog
::
info
(
"Exiting zmq server ..."
);
zmqServer
->
exitWorkers
();
spdlog
::
info
(
"Exited zmq server ..."
);
zmqServer
=
nullptr
;
}
ZMQServer.h
View file @
92137b06
...
@@ -44,6 +44,8 @@ using namespace std;
...
@@ -44,6 +44,8 @@ using namespace std;
class
ZMQServer
{
class
ZMQServer
{
public
:
public
:
static
ZMQServer
*
zmqServer
;
ZMQServer
();
ZMQServer
();
enum
{
enum
{
...
@@ -54,6 +56,8 @@ public:
...
@@ -54,6 +56,8 @@ public:
void
exitWorkers
();
void
exitWorkers
();
static
void
exitZMQServer
();
private
:
private
:
shared_ptr
<
zmq
::
context_t
>
ctx_
;
shared_ptr
<
zmq
::
context_t
>
ctx_
;
zmq
::
socket_t
frontend_
;
zmq
::
socket_t
frontend_
;
...
...
testw.cpp
View file @
92137b06
...
@@ -58,6 +58,7 @@
...
@@ -58,6 +58,7 @@
#include "SGXRegistrationServer.h"
#include "SGXRegistrationServer.h"
#include "SGXWalletServer.h"
#include "SGXWalletServer.h"
#include "ZMQClient.h"
#include "ZMQClient.h"
#include "ZMQServer.h"
#include "sgxwallet.h"
#include "sgxwallet.h"
#include "TestUtils.h"
#include "TestUtils.h"
#include "testw.h"
#include "testw.h"
...
@@ -77,7 +78,7 @@ public:
...
@@ -77,7 +78,7 @@ public:
}
}
~
TestFixture
()
{
~
TestFixture
()
{
exitZMQServer
();
ZMQServer
::
exitZMQServer
();
TestUtils
::
destroyEnclave
();
TestUtils
::
destroyEnclave
();
}
}
};
};
...
@@ -91,7 +92,7 @@ public:
...
@@ -91,7 +92,7 @@ public:
}
}
~
TestFixtureHTTPS
()
{
~
TestFixtureHTTPS
()
{
exitZMQServer
();
ZMQServer
::
exitZMQServer
();
TestUtils
::
destroyEnclave
();
TestUtils
::
destroyEnclave
();
}
}
};
};
...
@@ -104,7 +105,7 @@ public:
...
@@ -104,7 +105,7 @@ public:
}
}
~
TestFixtureNoResetFromBackup
()
{
~
TestFixtureNoResetFromBackup
()
{
exitZMQServer
();
ZMQServer
::
exitZMQServer
();
TestUtils
::
destroyEnclave
();
TestUtils
::
destroyEnclave
();
}
}
};
};
...
@@ -118,7 +119,7 @@ public:
...
@@ -118,7 +119,7 @@ public:
}
}
~
TestFixtureNoReset
()
{
~
TestFixtureNoReset
()
{
exitZMQServer
();
ZMQServer
::
exitZMQServer
();
TestUtils
::
destroyEnclave
();
TestUtils
::
destroyEnclave
();
}
}
};
};
...
...
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