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
697d554e
Commit
697d554e
authored
Oct 28, 2019
by
Sébastien Blin
Committed by
Adrien Béraud
Oct 31, 2019
Browse files
Options
Downloads
Patches
Plain Diff
dhtrunner: change put methods
parent
8edd6783
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
rust/src/dhtrunner.rs
+18
-6
18 additions, 6 deletions
rust/src/dhtrunner.rs
with
18 additions
and
6 deletions
rust/src/dhtrunner.rs
+
18
−
6
View file @
697d554e
...
...
@@ -217,25 +217,37 @@ impl DhtRunner {
}
}
pub
fn
put
<
'a
>
(
&
mut
self
,
h
:
&
InfoHash
,
v
:
Box
<
Value
>
,
done_cb
:
&
'a
mut
(
dyn
FnMut
(
bool
)))
{
pub
fn
put
<
'a
,
T
:
Into
<
Option
<
bool
>>
>
(
&
mut
self
,
h
:
&
InfoHash
,
v
:
Box
<
Value
>
,
done_cb
:
&
'a
mut
(
dyn
FnMut
(
bool
))
,
permanent
:
T
)
{
let
handler
=
Box
::
new
(
PutHandler
{
done_cb
,
});
let
handler
=
Box
::
into_raw
(
handler
)
as
*
mut
c_void
;
unsafe
{
dht_runner_put
(
&
mut
*
self
,
h
,
&*
v
,
put_handler_done
,
handler
,
false
)
dht_runner_put
(
&
mut
*
self
,
h
,
&*
v
,
put_handler_done
,
handler
,
permanent
.into
()
.unwrap_or
(
false
)
)
}
}
pub
fn
permanent_put
<
'a
>
(
&
mut
self
,
h
:
&
InfoHash
,
v
:
Box
<
Value
>
,
done_cb
:
&
'a
mut
(
dyn
FnMut
(
bool
)))
{
pub
fn
put_signed
<
'a
,
T
:
Into
<
Option
<
bool
>>>
(
&
mut
self
,
h
:
&
InfoHash
,
v
:
Box
<
Value
>
,
done_cb
:
&
'a
mut
(
dyn
FnMut
(
bool
)),
permanent
:
T
)
{
let
handler
=
Box
::
new
(
PutHandler
{
done_cb
,
});
let
handler
=
Box
::
into_raw
(
handler
)
as
*
mut
c_void
;
unsafe
{
dht_runner_put_signed
(
&
mut
*
self
,
h
,
&*
v
,
put_handler_done
,
handler
,
permanent
.into
()
.unwrap_or
(
false
))
}
}
pub
fn
put_encrypted
<
'a
,
T
:
Into
<
Option
<
bool
>>>
(
&
mut
self
,
h
:
&
InfoHash
,
v
:
Box
<
Value
>
,
to
:
&
InfoHash
,
done_cb
:
&
'a
mut
(
dyn
FnMut
(
bool
)),
permanent
:
T
)
{
let
handler
=
Box
::
new
(
PutHandler
{
done_cb
,
});
let
handler
=
Box
::
into_raw
(
handler
)
as
*
mut
c_void
;
unsafe
{
dht_runner_put
(
&
mut
*
self
,
h
,
&*
v
,
put_handler_done
,
handler
,
tru
e
)
dht_runner_put
_encrypted
(
&
mut
*
self
,
h
,
&*
v
,
to
,
put_handler_done
,
handler
,
permanent
.into
()
.unwrap_or
(
fals
e
)
)
}
}
...
...
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