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
25b33995
Commit
25b33995
authored
8 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
tools: gnutls cleanup
parent
b44f7ec6
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
tools/dhtchat.cpp
+0
-5
0 additions, 5 deletions
tools/dhtchat.cpp
tools/dhtnode.cpp
+4
-8
4 additions, 8 deletions
tools/dhtnode.cpp
tools/dhtscanner.cpp
+0
-7
0 additions, 7 deletions
tools/dhtscanner.cpp
with
4 additions
and
20 deletions
tools/dhtchat.cpp
+
0
−
5
View file @
25b33995
...
@@ -48,10 +48,6 @@ main(int argc, char **argv)
...
@@ -48,10 +48,6 @@ main(int argc, char **argv)
{
{
auto
params
=
parseArgs
(
argc
,
argv
);
auto
params
=
parseArgs
(
argc
,
argv
);
// TODO: remove with GnuTLS >= 3.3
if
(
int
rc
=
gnutls_global_init
())
throw
std
::
runtime_error
(
std
::
string
(
"Error initializing GnuTLS: "
)
+
gnutls_strerror
(
rc
));
DhtRunner
dht
;
DhtRunner
dht
;
dht
.
run
(
params
.
port
,
dht
::
crypto
::
generateIdentity
(
"DHT Chat Node"
),
true
,
params
.
network
);
dht
.
run
(
params
.
port
,
dht
::
crypto
::
generateIdentity
(
"DHT Chat Node"
),
true
,
params
.
network
);
...
@@ -129,6 +125,5 @@ main(int argc, char **argv)
...
@@ -129,6 +125,5 @@ main(int argc, char **argv)
std
::
cout
<<
std
::
endl
<<
"Stopping node..."
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
"Stopping node..."
<<
std
::
endl
;
dht
.
join
();
dht
.
join
();
gnutls_global_deinit
();
return
0
;
return
0
;
}
}
This diff is collapsed.
Click to expand it.
tools/dhtnode.cpp
+
4
−
8
View file @
25b33995
...
@@ -71,7 +71,7 @@ void print_help() {
...
@@ -71,7 +71,7 @@ void print_help() {
<<
std
::
endl
;
<<
std
::
endl
;
}
}
void
cmd_loop
(
std
::
shared_ptr
<
DhtRunner
>&
dht
,
std
::
map
<
std
::
string
,
indexation
::
Pht
>
indexes
,
dht_params
&
params
)
void
cmd_loop
(
std
::
shared_ptr
<
DhtRunner
>&
dht
,
dht_params
&
params
)
{
{
print_node_info
(
dht
,
params
);
print_node_info
(
dht
,
params
);
std
::
cout
<<
" (type 'h' or 'help' for a list of possible commands)"
<<
std
::
endl
<<
std
::
endl
;
std
::
cout
<<
" (type 'h' or 'help' for a list of possible commands)"
<<
std
::
endl
<<
std
::
endl
;
...
@@ -79,6 +79,8 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, std::map<std::string, indexation:
...
@@ -79,6 +79,8 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, std::map<std::string, indexation:
// using the GNU History API
// using the GNU History API
using_history
();
using_history
();
std
::
map
<
std
::
string
,
indexation
::
Pht
>
indexes
;
while
(
true
)
while
(
true
)
{
{
// using the GNU Readline API
// using the GNU Readline API
...
@@ -329,11 +331,7 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, std::map<std::string, indexation:
...
@@ -329,11 +331,7 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, std::map<std::string, indexation:
int
int
main
(
int
argc
,
char
**
argv
)
main
(
int
argc
,
char
**
argv
)
{
{
if
(
int
rc
=
gnutls_global_init
())
// TODO: remove with GnuTLS >= 3.3
throw
std
::
runtime_error
(
std
::
string
(
"Error initializing GnuTLS: "
)
+
gnutls_strerror
(
rc
));
auto
dht
=
std
::
make_shared
<
DhtRunner
>
();
auto
dht
=
std
::
make_shared
<
DhtRunner
>
();
std
::
map
<
std
::
string
,
indexation
::
Pht
>
indexes
;
try
{
try
{
auto
params
=
parseArgs
(
argc
,
argv
);
auto
params
=
parseArgs
(
argc
,
argv
);
...
@@ -369,7 +367,7 @@ main(int argc, char **argv)
...
@@ -369,7 +367,7 @@ main(int argc, char **argv)
while
(
true
)
while
(
true
)
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
30
));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
seconds
(
30
));
}
else
{
}
else
{
cmd_loop
(
dht
,
indexes
,
params
);
cmd_loop
(
dht
,
params
);
}
}
}
catch
(
const
std
::
exception
&
e
)
{
}
catch
(
const
std
::
exception
&
e
)
{
...
@@ -392,7 +390,5 @@ main(int argc, char **argv)
...
@@ -392,7 +390,5 @@ main(int argc, char **argv)
cv
.
wait
(
lk
,
[
&
](){
return
done
.
load
();
});
cv
.
wait
(
lk
,
[
&
](){
return
done
.
load
();
});
dht
->
join
();
dht
->
join
();
gnutls_global_deinit
();
return
0
;
return
0
;
}
}
This diff is collapsed.
Click to expand it.
tools/dhtscanner.cpp
+
0
−
7
View file @
25b33995
...
@@ -70,12 +70,6 @@ int
...
@@ -70,12 +70,6 @@ int
main
(
int
argc
,
char
**
argv
)
main
(
int
argc
,
char
**
argv
)
{
{
auto
params
=
parseArgs
(
argc
,
argv
);
auto
params
=
parseArgs
(
argc
,
argv
);
// TODO: remove with GnuTLS >= 3.3
int
rc
=
gnutls_global_init
();
if
(
rc
!=
GNUTLS_E_SUCCESS
)
throw
std
::
runtime_error
(
std
::
string
(
"Error initializing GnuTLS: "
)
+
gnutls_strerror
(
rc
));
auto
ca_tmp
=
dht
::
crypto
::
generateIdentity
(
"DHT Node CA"
);
auto
ca_tmp
=
dht
::
crypto
::
generateIdentity
(
"DHT Node CA"
);
auto
crt_tmp
=
dht
::
crypto
::
generateIdentity
(
"Scanner node"
,
ca_tmp
);
auto
crt_tmp
=
dht
::
crypto
::
generateIdentity
(
"Scanner node"
,
ca_tmp
);
...
@@ -110,6 +104,5 @@ main(int argc, char **argv)
...
@@ -110,6 +104,5 @@ main(int argc, char **argv)
std
::
cout
<<
"Node "
<<
*
n
<<
std
::
endl
;
std
::
cout
<<
"Node "
<<
*
n
<<
std
::
endl
;
dht
.
join
();
dht
.
join
();
gnutls_global_deinit
();
return
0
;
return
0
;
}
}
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