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
2f0bafe8
Unverified
Commit
2f0bafe8
authored
Dec 15, 2020
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding zmq
parent
e4afc8fa
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
111 additions
and
6 deletions
+111
-6
.gitmodules
.gitmodules
+3
-0
Makefile.am
Makefile.am
+5
-2
ServerInit.cpp
ServerInit.cpp
+3
-0
ServerWorker.h
ServerWorker.h
+1
-0
ZMQMessage.cpp
ZMQMessage.cpp
+41
-0
ZMQMessage.h
ZMQMessage.h
+50
-0
ZMQServer.cpp
ZMQServer.cpp
+0
-4
ZMQServer.h
ZMQServer.h
+7
-0
rapidjson
rapidjson
+1
-0
No files found.
.gitmodules
View file @
2f0bafe8
...
...
@@ -22,3 +22,6 @@
[submodule "cppzmq"]
path = cppzmq
url = https://github.com/zeromq/cppzmq.git
[submodule "rapidjson"]
path = rapidjson
url = https://github.com/Tencent/rapidjson.git
Makefile.am
View file @
2f0bafe8
...
...
@@ -49,7 +49,10 @@ AM_CFLAGS = -DUSER_SPACE -g -Og -rdynamic -Wl,--no-as-needed -lSegFault -DSGXWAL
AM_CXXFLAGS
=
${
AM_CPPFLAGS
}
-rdynamic
-Wl
,--no-as-needed
-lSegFault
-DSGXWALLET_VERSION
=
"
$(WALLET_VERSION)
"
AM_CPPFLAGS
+=
-DSGXWALLET_VERSION
=
"
$(WALLET_VERSION)
"
-Wall
-DSKALE_SGX
=
1
-DBINARY_OUTPUT
=
1
-Ileveldb
/include
-IlibBLS
/bls
-IlibBLS
/libff
-IlibBLS
-fno-builtin-memset
$(GMP_CPPFLAGS)
-I
.
-I
./libBLS/deps/deps_inst/x86_or_x64/include
-I
./libzmq/include
-I
./cppzmq
-I
./third_party/zguide
AM_CPPFLAGS
+=
-DSGXWALLET_VERSION
=
"
$(WALLET_VERSION)
"
-Wall
-DSKALE_SGX
=
1
-DBINARY_OUTPUT
=
1
-Ileveldb
/include
-IlibBLS
/bls
\
-IlibBLS
/libff
-IlibBLS
-fno-builtin-memset
$(GMP_CPPFLAGS)
-I
.
\
-I
./libBLS/deps/deps_inst/x86_or_x64/include
-I
./libzmq/include
-I
./cppzmq
-I
./third_party/zguide
\
-I
./rapidjson/include/rapidjson
## Additional targets to remove with 'make clean'. You must list
## any edger8r generated files here.
...
...
@@ -66,7 +69,7 @@ bin_PROGRAMS = sgxwallet testw cert_util
## have to be explicitly listed.
## have to be explicitly listed
COMMON_SRC
=
ZMQServer.cpp ServerWorker.cpp InvalidStateException.cpp Exception.cpp InvalidArgumentException.cpp Log.cpp
\
COMMON_SRC
=
ZMQ
Message.cpp ZMQ
Server.cpp ServerWorker.cpp InvalidStateException.cpp Exception.cpp InvalidArgumentException.cpp Log.cpp
\
SGXWalletServer.cpp SGXRegistrationServer.cpp CSRManagerServer.cpp BLSCrypto.cpp
\
ECDSACrypto.cpp
\
DKGCrypto.cpp ServerInit.cpp BLSPrivateKeyShareSGX.cpp LevelDB.cpp ServerDataChecker.cpp SEKManager.cpp
\
...
...
ServerInit.cpp
View file @
2f0bafe8
...
...
@@ -127,10 +127,13 @@ void initUserSpace() {
}
void
exitZMQServer
()
{
auto
doExit
=
!
exiting
.
exchange
(
true
);
if
(
doExit
)
{
spdlog
::
info
(
"Exiting zmq server ..."
);
delete
zmqServer
;
spdlog
::
info
(
"Exited zmq server ..."
);
zmqServer
=
nullptr
;
}
...
...
ServerWorker.h
View file @
2f0bafe8
...
...
@@ -14,6 +14,7 @@
#include "zhelpers.hpp"
#include "third_party/spdlog/spdlog.h"
#include "document.h"
class
ServerWorker
{
...
...
ZMQMessage.cpp
0 → 100644
View file @
2f0bafe8
/*
Copyright (C) 2020 SKALE Labs
This file is part of skale-consensus.
skale-consensus is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
skale-consensus is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with skale-consensus. If not, see <https://www.gnu.org/licenses/>.
@file ZMQMessage.cpp
@author Stan Kladko
@date 2020
*/
#include "common.h"
#include "ZMQMessage.h"
uint64_t
ZMQMessage
::
getUint64Rapid
(
const
char
*
_name
)
{
CHECK_STATE
(
_name
);
CHECK_STATE
(
d
->
HasMember
(
_name
));
const
rapidjson
::
Value
&
a
=
(
*
d
)[
_name
];
CHECK_STATE
(
a
.
IsUint64
());
return
a
.
GetUint64
();
};
string
ZMQMessage
::
getStringRapid
(
const
char
*
_name
)
{
CHECK_STATE
(
_name
);
CHECK_STATE
(
d
->
HasMember
(
_name
));
CHECK_STATE
((
*
d
)[
_name
].
IsString
());
return
(
*
d
)[
_name
].
GetString
();
};
ZMQMessage.h
0 → 100644
View file @
2f0bafe8
/*
Copyright (C) 2018-2019 SKALE Labs
This file is part of skale-consensus.
skale-consensus is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
skale-consensus is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with skale-consensus. If not, see <https://www.gnu.org/licenses/>.
@file ZMQMessage.h
@author Stan Kladko
@date 2018
*/
#pragma once
#include "document.h"
using
namespace
std
;
class
ZMQMessage
{
shared_ptr
<
rapidjson
::
Document
>
d
;
protected
:
public
:
explicit
ZMQMessage
(
string
&
_jsonMessage
);
virtual
~
ZMQMessage
();
string
getStringRapid
(
const
char
*
_name
);
uint64_t
getUint64Rapid
(
const
char
*
_name
);
};
\ No newline at end of file
ZMQServer.cpp
View file @
2f0bafe8
...
...
@@ -25,9 +25,7 @@
#include "third_party/spdlog/spdlog.h"
#include "ServerWorker.h"
#include "ZMQServer.h"
#include "sgxwallet_common.h"
using
namespace
std
;
...
...
@@ -60,8 +58,6 @@ void ZMQServer::run() {
exit
(
-
101
);
}
static
std
::
vector
<
ServerWorker
*>
worker
;
static
std
::
vector
<
std
::
thread
*>
worker_thread
;
spdlog
::
info
(
"Creating {} zmq server workers ..."
,
kMaxThread
);
...
...
ZMQServer.h
View file @
2f0bafe8
...
...
@@ -35,6 +35,9 @@
#include <zmq.hpp>
#include "zhelpers.hpp"
#include "ServerWorker.h"
using
namespace
std
;
...
...
@@ -55,6 +58,10 @@ private:
zmq
::
context_t
ctx_
;
zmq
::
socket_t
frontend_
;
zmq
::
socket_t
backend_
;
std
::
vector
<
ServerWorker
*>
worker
;
std
::
vector
<
std
::
thread
*>
worker_thread
;
};
#endif //SGXWALLET_ZMQServer_H
rapidjson
@
0ccdbf36
Subproject commit 0ccdbf364c577803e2a751f5aededce935314313
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