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
c1f805e6
Commit
c1f805e6
authored
5 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
tools: use default port from network utils
parent
25c9375d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
tools/dhtnode.cpp
+1
-1
1 addition, 1 deletion
tools/dhtnode.cpp
tools/tools_common.h
+2
-3
2 additions, 3 deletions
tools/tools_common.h
with
3 additions
and
4 deletions
tools/dhtnode.cpp
+
1
−
1
View file @
c1f805e6
...
@@ -196,7 +196,7 @@ void cmd_loop(std::shared_ptr<DhtRunner>& node, dht_params& params
...
@@ -196,7 +196,7 @@ void cmd_loop(std::shared_ptr<DhtRunner>& node, dht_params& params
try
{
try
{
auto
addr
=
splitPort
(
idstr
);
auto
addr
=
splitPort
(
idstr
);
if
(
not
addr
.
first
.
empty
()
and
addr
.
second
.
empty
())
if
(
not
addr
.
first
.
empty
()
and
addr
.
second
.
empty
())
addr
.
second
=
std
::
to_string
(
DHT_DEFAULT_PORT
);
addr
.
second
=
std
::
to_string
(
dht
::
net
::
DHT_DEFAULT_PORT
);
node
->
bootstrap
(
addr
.
first
.
c_str
(),
addr
.
second
.
c_str
());
node
->
bootstrap
(
addr
.
first
.
c_str
(),
addr
.
second
.
c_str
());
}
catch
(
const
std
::
exception
&
e
)
{
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
std
::
endl
;
std
::
cerr
<<
e
.
what
()
<<
std
::
endl
;
...
...
This diff is collapsed.
Click to expand it.
tools/tools_common.h
+
2
−
3
View file @
c1f805e6
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include
<opendht.h>
#include
<opendht.h>
#include
<opendht/log.h>
#include
<opendht/log.h>
#include
<opendht/crypto.h>
#include
<opendht/crypto.h>
#include
<opendht/network_utils.h>
#ifndef WIN32_NATIVE
#ifndef WIN32_NATIVE
#include
<getopt.h>
#include
<getopt.h>
#include
<readline/readline.h>
#include
<readline/readline.h>
...
@@ -106,8 +107,6 @@ loadFile(const std::string& path)
...
@@ -106,8 +107,6 @@ loadFile(const std::string& path)
return
buffer
;
return
buffer
;
}
}
static
const
constexpr
in_port_t
DHT_DEFAULT_PORT
=
4222
;
struct
dht_params
{
struct
dht_params
{
bool
help
{
false
};
// print help and exit
bool
help
{
false
};
// print help and exit
bool
version
{
false
};
bool
version
{
false
};
...
@@ -200,7 +199,7 @@ parseArgs(int argc, char **argv) {
...
@@ -200,7 +199,7 @@ parseArgs(int argc, char **argv) {
case
'b'
:
case
'b'
:
params
.
bootstrap
=
dht
::
splitPort
((
optarg
[
0
]
==
'='
)
?
optarg
+
1
:
optarg
);
params
.
bootstrap
=
dht
::
splitPort
((
optarg
[
0
]
==
'='
)
?
optarg
+
1
:
optarg
);
if
(
not
params
.
bootstrap
.
first
.
empty
()
and
params
.
bootstrap
.
second
.
empty
())
{
if
(
not
params
.
bootstrap
.
first
.
empty
()
and
params
.
bootstrap
.
second
.
empty
())
{
params
.
bootstrap
.
second
=
std
::
to_string
(
DHT_DEFAULT_PORT
);
params
.
bootstrap
.
second
=
std
::
to_string
(
dht
::
net
::
DHT_DEFAULT_PORT
);
}
}
break
;
break
;
case
'V'
:
case
'V'
:
...
...
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