Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Beyond Protocol
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Beyond AKA
Beyond Protocol
Commits
b4a49771
Commit
b4a49771
authored
2 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Plain Diff
Merge branch 'bug/
#51
' into 'main'
#51
Fix for node details bug See merge request beyondaka/beyond-protocol!30
parents
52b776cd
155da7ec
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/node.cpp
+5
-2
5 additions, 2 deletions
src/node.cpp
src/self.cpp
+2
-2
2 additions, 2 deletions
src/self.cpp
test/webservice_e2e.cpp
+6
-0
6 additions, 0 deletions
test/webservice_e2e.cpp
with
13 additions
and
4 deletions
src/node.cpp
+
5
−
2
View file @
b4a49771
...
@@ -90,8 +90,11 @@ void Node::createStream(const std::string &uri, FrameID id) {
...
@@ -90,8 +90,11 @@ void Node::createStream(const std::string &uri, FrameID id) {
}
}
nlohmann
::
json
Node
::
details
()
{
nlohmann
::
json
Node
::
details
()
{
const
std
::
string
res
=
peer_
->
call
<
std
::
string
>
(
"node_details"
);
const
auto
res
=
peer_
->
call
<
std
::
vector
<
std
::
string
>>
(
"node_details"
);
return
nlohmann
::
json
::
parse
(
res
);
if
(
res
.
size
()
>
0
)
{
return
nlohmann
::
json
::
parse
(
res
[
0
]);
}
return
{};
}
}
int64_t
Node
::
ping
()
{
int64_t
Node
::
ping
()
{
...
...
This diff is collapsed.
Click to expand it.
src/self.cpp
+
2
−
2
View file @
b4a49771
...
@@ -173,8 +173,8 @@ void Self::onCreateStream(const std::function<void(const std::string &uri, Frame
...
@@ -173,8 +173,8 @@ void Self::onCreateStream(const std::function<void(const std::string &uri, Frame
}
}
void
Self
::
onNodeDetails
(
const
std
::
function
<
nlohmann
::
json
()
>
&
cb
)
{
void
Self
::
onNodeDetails
(
const
std
::
function
<
nlohmann
::
json
()
>
&
cb
)
{
universe_
->
bind
(
"node_details"
,
[
cb
]()
{
universe_
->
bind
(
"node_details"
,
[
cb
]()
->
std
::
vector
<
std
::
string
>
{
return
cb
().
dump
();
return
{
cb
().
dump
()
}
;
});
});
}
}
...
...
This diff is collapsed.
Click to expand it.
test/webservice_e2e.cpp
+
6
−
0
View file @
b4a49771
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
#include
<ftl/protocol/self.hpp>
#include
<ftl/protocol/self.hpp>
#include
<ftl/protocol/node.hpp>
#include
<ftl/protocol/node.hpp>
#include
<ftl/uri.hpp>
#include
<ftl/uri.hpp>
#include
<nlohmann/json.hpp>
// --- Tests -------------------------------------------------------------------
// --- Tests -------------------------------------------------------------------
...
@@ -19,6 +20,11 @@ TEST_CASE("Webservice connection", "[net]") {
...
@@ -19,6 +20,11 @@ TEST_CASE("Webservice connection", "[net]") {
REQUIRE
(
p
);
REQUIRE
(
p
);
REQUIRE
(
p
->
waitConnection
(
5
)
);
REQUIRE
(
p
->
waitConnection
(
5
)
);
auto
details
=
p
->
details
();
REQUIRE
(
details
.
contains
(
"id"
));
LOG
(
INFO
)
<<
"Details: "
<<
details
.
dump
();
}
}
ftl
::
protocol
::
reset
();
ftl
::
protocol
::
reset
();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment