Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
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
savoirfairelinux
opendht
Commits
15f4ea4d
Commit
15f4ea4d
authored
9 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
node: add toString()
parent
92df1f5a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/opendht/node.h
+2
-0
2 additions, 0 deletions
include/opendht/node.h
src/node.cpp
+10
-0
10 additions, 0 deletions
src/node.cpp
with
12 additions
and
0 deletions
include/opendht/node.h
+
2
−
0
View file @
15f4ea4d
...
...
@@ -83,6 +83,8 @@ struct Node {
*/
void
reset
()
{
pinged
=
0
;
}
std
::
string
toString
()
const
;
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
s
,
const
Node
&
h
);
static
constexpr
const
std
::
chrono
::
minutes
NODE_GOOD_TIME
{
120
};
...
...
This diff is collapsed.
Click to expand it.
src/node.cpp
+
10
−
0
View file @
15f4ea4d
...
...
@@ -21,6 +21,8 @@
#include
"node.h"
#include
<sstream>
namespace
dht
{
constexpr
std
::
chrono
::
minutes
Node
::
NODE_EXPIRE_TIME
;
...
...
@@ -77,6 +79,14 @@ Node::received(time_point now, bool answer)
}
}
std
::
string
Node
::
toString
()
const
{
std
::
stringstream
ss
;
ss
<<
(
*
this
);
return
ss
.
str
();
}
std
::
ostream
&
operator
<<
(
std
::
ostream
&
s
,
const
Node
&
h
)
{
s
<<
h
.
id
<<
" "
<<
print_addr
(
h
.
ss
,
h
.
sslen
);
...
...
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