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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
01f2ad9e
Commit
01f2ad9e
authored
Nov 11, 2019
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
tools: show connectivity change in log
parent
2dd4cde0
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/opendht/callbacks.h
+7
-0
7 additions, 0 deletions
include/opendht/callbacks.h
tools/dhtchat.cpp
+1
-7
1 addition, 7 deletions
tools/dhtchat.cpp
tools/tools_common.h
+5
-0
5 additions, 0 deletions
tools/tools_common.h
with
13 additions
and
7 deletions
include/opendht/callbacks.h
+
7
−
0
View file @
01f2ad9e
...
@@ -44,6 +44,13 @@ enum class NodeStatus {
...
@@ -44,6 +44,13 @@ enum class NodeStatus {
Connected
// 1+ good nodes
Connected
// 1+ good nodes
};
};
inline
constexpr
const
char
*
statusToStr
(
NodeStatus
status
)
{
return
status
==
NodeStatus
::
Connected
?
"connected"
:
(
status
==
NodeStatus
::
Connecting
?
"connecting"
:
"disconnected"
);
}
struct
OPENDHT_PUBLIC
NodeStats
{
struct
OPENDHT_PUBLIC
NodeStats
{
unsigned
good_nodes
{
0
},
unsigned
good_nodes
{
0
},
dubious_nodes
{
0
},
dubious_nodes
{
0
},
...
...
This diff is collapsed.
Click to expand it.
tools/dhtchat.cpp
+
1
−
7
View file @
01f2ad9e
...
@@ -57,19 +57,13 @@ main(int argc, char **argv)
...
@@ -57,19 +57,13 @@ main(int argc, char **argv)
DhtRunner
dht
;
DhtRunner
dht
;
try
{
try
{
params
.
generate_identity
=
true
;
auto
dhtConf
=
getDhtConfig
(
params
);
auto
dhtConf
=
getDhtConfig
(
params
);
dht
.
run
(
params
.
port
,
dhtConf
.
first
,
std
::
move
(
dhtConf
.
second
));
dht
.
run
(
params
.
port
,
dhtConf
.
first
,
std
::
move
(
dhtConf
.
second
));
if
(
not
params
.
bootstrap
.
first
.
empty
())
if
(
not
params
.
bootstrap
.
first
.
empty
())
dht
.
bootstrap
(
params
.
bootstrap
.
first
.
c_str
(),
params
.
bootstrap
.
second
.
c_str
());
dht
.
bootstrap
(
params
.
bootstrap
.
first
.
c_str
(),
params
.
bootstrap
.
second
.
c_str
());
#ifdef OPENDHT_PROXY_CLIENT
if
(
!
params
.
proxyclient
.
empty
())
{
dht
.
setProxyServer
(
params
.
proxyclient
);
dht
.
enableProxy
(
true
);
}
#endif //OPENDHT_PROXY_CLIENT
print_node_info
(
dht
,
params
);
print_node_info
(
dht
,
params
);
std
::
cout
<<
" type 'c {hash}' to join a channel"
<<
std
::
endl
<<
std
::
endl
;
std
::
cout
<<
" type 'c {hash}' to join a channel"
<<
std
::
endl
<<
std
::
endl
;
...
...
This diff is collapsed.
Click to expand it.
tools/tools_common.h
+
5
−
0
View file @
01f2ad9e
...
@@ -171,6 +171,11 @@ getDhtConfig(dht_params& params)
...
@@ -171,6 +171,11 @@ getDhtConfig(dht_params& params)
else
else
context
.
logger
=
dht
::
log
::
getStdLogger
();
context
.
logger
=
dht
::
log
::
getStdLogger
();
}
}
if
(
context
.
logger
)
{
context
.
statusChangedCallback
=
[
logger
=
*
context
.
logger
](
dht
::
NodeStatus
status4
,
dht
::
NodeStatus
status6
)
{
logger
.
WARN
(
"Connectivity changed: IPv4: %s, IPv6: %s"
,
dht
::
statusToStr
(
status4
),
dht
::
statusToStr
(
status6
));
};
}
return
{
std
::
move
(
config
),
std
::
move
(
context
)};
return
{
std
::
move
(
config
),
std
::
move
(
context
)};
}
}
...
...
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