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
00e595d7
Commit
00e595d7
authored
3 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
dht: fail if op key is null
parent
a178a8f8
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dht.cpp
+22
-1
22 additions, 1 deletion
src/dht.cpp
with
22 additions
and
1 deletion
src/dht.cpp
+
22
−
1
View file @
00e595d7
...
...
@@ -873,6 +873,11 @@ Dht::listenTo(const InfoHash& id, sa_family_t af, ValueCallback cb, Value::Filte
size_t
Dht
::
listen
(
const
InfoHash
&
id
,
ValueCallback
cb
,
Value
::
Filter
f
,
Where
where
)
{
if
(
not
id
)
{
if
(
logger_
)
logger_
->
w
(
id
,
"Listen called with invalid key"
);
return
0
;
}
scheduler
.
syncTime
();
auto
token
=
++
listener_token
;
...
...
@@ -955,7 +960,9 @@ struct GetStatus : public OpStatus {
void
Dht
::
put
(
const
InfoHash
&
id
,
Sp
<
Value
>
val
,
DoneCallback
callback
,
time_point
created
,
bool
permanent
)
{
if
(
not
val
)
{
if
(
not
id
or
not
val
)
{
if
(
logger_
)
logger_
->
w
(
id
,
"Put called with invalid key or value"
);
if
(
callback
)
callback
(
false
,
{});
return
;
...
...
@@ -1025,6 +1032,13 @@ bool callbackWrapper(Cb get_cb, DoneCallback done_cb, const std::vector<Sp<T>>&
void
Dht
::
get
(
const
InfoHash
&
id
,
GetCallback
getcb
,
DoneCallback
donecb
,
Value
::
Filter
&&
filter
,
Where
&&
where
)
{
if
(
not
id
)
{
if
(
logger_
)
logger_
->
w
(
id
,
"Get called with invalid key"
);
if
(
donecb
)
donecb
(
false
,
{});
return
;
}
scheduler
.
syncTime
();
auto
op
=
std
::
make_shared
<
GetStatus
<
std
::
map
<
Value
::
Id
,
Sp
<
Value
>>>>
();
...
...
@@ -1065,6 +1079,13 @@ Dht::get(const InfoHash& id, GetCallback getcb, DoneCallback donecb, Value::Filt
void
Dht
::
query
(
const
InfoHash
&
id
,
QueryCallback
cb
,
DoneCallback
done_cb
,
Query
&&
q
)
{
if
(
not
id
)
{
if
(
logger_
)
logger_
->
w
(
id
,
"Query called with invalid key"
);
if
(
done_cb
)
done_cb
(
false
,
{});
return
;
}
scheduler
.
syncTime
();
auto
op
=
std
::
make_shared
<
GetStatus
<
std
::
vector
<
Sp
<
FieldValueIndex
>>>>
();
auto
f
=
q
.
where
.
getFilter
();
...
...
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