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
80b944d9
Commit
80b944d9
authored
7 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
dhtnode: prevent crash in cancelListen
parent
74bfced9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/dhtnode.cpp
+14
-6
14 additions, 6 deletions
tools/dhtnode.cpp
with
14 additions
and
6 deletions
tools/dhtnode.cpp
+
14
−
6
View file @
80b944d9
...
@@ -254,11 +254,7 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params
...
@@ -254,11 +254,7 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params
}
}
dht
::
InfoHash
id
;
dht
::
InfoHash
id
;
if
(
op
==
"cl"
)
{
if
(
false
)
{}
std
::
string
hash
,
rem
;
iss
>>
hash
>>
rem
;
dht
->
cancelListen
(
dht
::
InfoHash
(
hash
),
std
::
stoul
(
rem
));
}
#ifdef OPENDHT_INDEXATION
#ifdef OPENDHT_INDEXATION
else
if
(
op
==
"il"
or
op
==
"ii"
)
{
else
if
(
op
==
"il"
or
op
==
"ii"
)
{
// Pht syntax
// Pht syntax
...
@@ -268,7 +264,7 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params
...
@@ -268,7 +264,7 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params
return
i
.
first
==
index
;
return
i
.
first
==
index
;
})
==
indexes
.
end
();
})
==
indexes
.
end
();
if
(
not
index
.
size
())
{
if
(
not
index
.
size
())
{
std
::
c
out
<<
"You must enter the index name."
<<
std
::
endl
;
std
::
c
err
<<
"You must enter the index name."
<<
std
::
endl
;
continue
;
continue
;
}
else
if
(
new_index
)
{
}
else
if
(
new_index
)
{
using
namespace
dht
::
indexation
;
using
namespace
dht
::
indexation
;
...
@@ -338,6 +334,18 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params
...
@@ -338,6 +334,18 @@ void cmd_loop(std::shared_ptr<DhtRunner>& dht, dht_params& params
auto
t
=
token
.
get
();
auto
t
=
token
.
get
();
std
::
cout
<<
"Listening, token: "
<<
t
<<
std
::
endl
;
std
::
cout
<<
"Listening, token: "
<<
t
<<
std
::
endl
;
}
}
if
(
op
==
"cl"
)
{
std
::
string
rem
;
iss
>>
rem
;
size_t
token
;
try
{
token
=
std
::
stoul
(
rem
);
}
catch
(...)
{
std
::
cerr
<<
"Syntax: cl [key] [token]"
<<
std
::
endl
;
continue
;
}
dht
->
cancelListen
(
id
,
token
);
}
else
if
(
op
==
"p"
)
{
else
if
(
op
==
"p"
)
{
std
::
string
v
;
std
::
string
v
;
iss
>>
v
;
iss
>>
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