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
7db0c154
Commit
7db0c154
authored
8 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
tools: catch exceptions
parent
2fc7cc57
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/dhtchat.cpp
+67
-63
67 additions, 63 deletions
tools/dhtchat.cpp
tools/dhtscanner.cpp
+26
-22
26 additions, 22 deletions
tools/dhtscanner.cpp
with
93 additions
and
85 deletions
tools/dhtchat.cpp
+
67
−
63
View file @
7db0c154
...
@@ -62,6 +62,7 @@ main(int argc, char **argv)
...
@@ -62,6 +62,7 @@ main(int argc, char **argv)
#endif
#endif
DhtRunner
dht
;
DhtRunner
dht
;
try
{
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
);
if
(
not
params
.
bootstrap
.
first
.
empty
())
if
(
not
params
.
bootstrap
.
first
.
empty
())
...
@@ -137,6 +138,9 @@ main(int argc, char **argv)
...
@@ -137,6 +138,9 @@ main(int argc, char **argv)
}
}
}
}
}
}
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cerr
<<
std
::
endl
<<
e
.
what
()
<<
std
::
endl
;
}
std
::
cout
<<
std
::
endl
<<
"Stopping node..."
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
"Stopping node..."
<<
std
::
endl
;
dht
.
join
();
dht
.
join
();
...
...
This diff is collapsed.
Click to expand it.
tools/dhtscanner.cpp
+
26
−
22
View file @
7db0c154
...
@@ -85,6 +85,7 @@ main(int argc, char **argv)
...
@@ -85,6 +85,7 @@ main(int argc, char **argv)
}
}
DhtRunner
dht
;
DhtRunner
dht
;
try
{
dht
.
run
(
params
.
port
,
{},
true
,
params
.
network
);
dht
.
run
(
params
.
port
,
{},
true
,
params
.
network
);
if
(
not
params
.
bootstrap
.
first
.
empty
())
if
(
not
params
.
bootstrap
.
first
.
empty
())
...
@@ -114,6 +115,9 @@ main(int argc, char **argv)
...
@@ -114,6 +115,9 @@ main(int argc, char **argv)
std
::
cout
<<
std
::
endl
<<
"Scan ended: "
<<
all_nodes
->
size
()
<<
" nodes found."
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
"Scan ended: "
<<
all_nodes
->
size
()
<<
" nodes found."
<<
std
::
endl
;
for
(
const
auto
&
n
:
*
all_nodes
)
for
(
const
auto
&
n
:
*
all_nodes
)
std
::
cout
<<
"Node "
<<
*
n
<<
std
::
endl
;
std
::
cout
<<
"Node "
<<
*
n
<<
std
::
endl
;
}
catch
(
const
std
::
exception
&
e
)
{
std
::
cerr
<<
std
::
endl
<<
e
.
what
()
<<
std
::
endl
;
}
dht
.
join
();
dht
.
join
();
#ifdef WIN32_NATIVE
#ifdef WIN32_NATIVE
...
...
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