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
0d8128ad
Unverified
Commit
0d8128ad
authored
Feb 01, 2021
by
kladko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug/SKALE-3751-enable-zeromq
parent
3ced7e60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
ZMQClient.cpp
ZMQClient.cpp
+13
-3
ZMQClient.h
ZMQClient.h
+3
-0
No files found.
ZMQClient.cpp
View file @
0d8128ad
...
...
@@ -43,6 +43,8 @@ shared_ptr <ZMQMessage> ZMQClient::doRequestReply(Json::Value &_req) {
if
(
sign
)
{
CHECK_STATE
(
!
certificate
.
empty
());
CHECK_STATE
(
!
key
.
empty
());
_req
[
"cert"
]
=
certificate
;
_req
[
"msgSig"
]
=
"haha"
;
}
...
...
@@ -122,6 +124,12 @@ string ZMQClient::doZmqRequestReply(string &_req) {
}
string
ZMQClient
::
readFileIntoString
(
const
string
&
_fileName
)
{
ifstream
t
(
_fileName
);
string
str
((
istreambuf_iterator
<
char
>
(
t
)),
istreambuf_iterator
<
char
>
());
return
str
;
}
ZMQClient
::
ZMQClient
(
const
string
&
ip
,
uint16_t
port
,
bool
_sign
,
const
string
&
_certFileName
,
const
string
&
_certKeyName
)
:
ctx
(
1
),
sign
(
_sign
),
certKeyName
(
_certKeyName
),
certFileName
(
_certFileName
)
{
...
...
@@ -132,11 +140,13 @@ ZMQClient::ZMQClient(const string &ip, uint16_t port, bool _sign, const string &
CHECK_STATE
(
!
_certFileName
.
empty
());
CHECK_STATE
(
!
_certKeyName
.
empty
());
ifstream
t
(
_certFileName
);
string
str
((
istreambuf_iterator
<
char
>
(
t
)),
istreambuf_iterator
<
char
>
());
certificate
=
str
;
certificate
=
readFileIntoString
(
_certFileName
);
CHECK_STATE
(
!
certificate
.
empty
());
key
=
readFileIntoString
(
_certKeyName
);
CHECK_STATE
(
!
key
.
empty
());
}
else
{
CHECK_STATE
(
_certFileName
.
empty
());
CHECK_STATE
(
_certKeyName
.
empty
());
...
...
ZMQClient.h
View file @
0d8128ad
...
...
@@ -49,6 +49,8 @@ private:
string
certFileName
=
""
;
string
certKeyName
=
""
;
string
certificate
=
""
;
string
key
=
""
;
recursive_mutex
mutex
;
...
...
@@ -66,6 +68,7 @@ private:
uint64_t
getProcessID
();
static
string
readFileIntoString
(
const
string
&
_fileName
);
public
:
...
...
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