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
18036178
Unverified
Commit
18036178
authored
8 years ago
by
kaldoran
Browse files
Options
Downloads
Patches
Plain Diff
Add timepoint into the API of SecureDht and DhtRunner
parent
5dd95a2a
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
include/opendht/dhtrunner.h
+7
-7
7 additions, 7 deletions
include/opendht/dhtrunner.h
src/dhtrunner.cpp
+6
-6
6 additions, 6 deletions
src/dhtrunner.cpp
with
13 additions
and
13 deletions
include/opendht/dhtrunner.h
+
7
−
7
View file @
18036178
...
@@ -156,16 +156,16 @@ public:
...
@@ -156,16 +156,16 @@ public:
void
cancelListen
(
InfoHash
h
,
size_t
token
);
void
cancelListen
(
InfoHash
h
,
size_t
token
);
void
cancelListen
(
InfoHash
h
,
std
::
shared_future
<
size_t
>
token
);
void
cancelListen
(
InfoHash
h
,
std
::
shared_future
<
size_t
>
token
);
void
put
(
InfoHash
hash
,
std
::
shared_ptr
<
Value
>
value
,
DoneCallback
cb
=
{},
bool
permanent
=
false
);
void
put
(
InfoHash
hash
,
std
::
shared_ptr
<
Value
>
value
,
DoneCallback
cb
=
{},
time_point
created
=
time_point
::
max
(),
bool
permanent
=
false
);
void
put
(
InfoHash
hash
,
std
::
shared_ptr
<
Value
>
value
,
DoneCallbackSimple
cb
,
bool
permanent
=
false
)
{
void
put
(
InfoHash
hash
,
std
::
shared_ptr
<
Value
>
value
,
DoneCallbackSimple
cb
,
time_point
created
=
time_point
::
max
(),
bool
permanent
=
false
)
{
put
(
hash
,
value
,
bindDoneCb
(
cb
),
permanent
);
put
(
hash
,
value
,
bindDoneCb
(
cb
),
created
,
permanent
);
}
}
void
put
(
InfoHash
hash
,
Value
&&
value
,
DoneCallback
cb
=
{},
bool
permanent
=
false
);
void
put
(
InfoHash
hash
,
Value
&&
value
,
DoneCallback
cb
=
{},
time_point
created
=
time_point
::
max
(),
bool
permanent
=
false
);
void
put
(
InfoHash
hash
,
Value
&&
value
,
DoneCallbackSimple
cb
,
bool
permanent
=
false
)
{
void
put
(
InfoHash
hash
,
Value
&&
value
,
DoneCallbackSimple
cb
,
time_point
created
=
time_point
::
max
(),
bool
permanent
=
false
)
{
put
(
hash
,
std
::
forward
<
Value
>
(
value
),
bindDoneCb
(
cb
),
permanent
);
put
(
hash
,
std
::
forward
<
Value
>
(
value
),
bindDoneCb
(
cb
),
created
,
permanent
);
}
}
void
put
(
const
std
::
string
&
key
,
Value
&&
value
,
DoneCallbackSimple
cb
=
{},
bool
permanent
=
false
);
void
put
(
const
std
::
string
&
key
,
Value
&&
value
,
DoneCallbackSimple
cb
=
{},
time_point
created
=
time_point
::
max
(),
bool
permanent
=
false
);
void
cancelPut
(
const
InfoHash
&
h
,
const
Value
::
Id
&
id
);
void
cancelPut
(
const
InfoHash
&
h
,
const
Value
::
Id
&
id
);
...
...
This diff is collapsed.
Click to expand it.
src/dhtrunner.cpp
+
6
−
6
View file @
18036178
...
@@ -484,30 +484,30 @@ DhtRunner::cancelListen(InfoHash h, std::shared_future<size_t> token)
...
@@ -484,30 +484,30 @@ DhtRunner::cancelListen(InfoHash h, std::shared_future<size_t> token)
}
}
void
void
DhtRunner
::
put
(
InfoHash
hash
,
Value
&&
value
,
DoneCallback
cb
,
bool
permanent
)
DhtRunner
::
put
(
InfoHash
hash
,
Value
&&
value
,
DoneCallback
cb
,
time_point
created
,
bool
permanent
)
{
{
std
::
lock_guard
<
std
::
mutex
>
lck
(
storage_mtx
);
std
::
lock_guard
<
std
::
mutex
>
lck
(
storage_mtx
);
auto
sv
=
std
::
make_shared
<
Value
>
(
std
::
move
(
value
));
auto
sv
=
std
::
make_shared
<
Value
>
(
std
::
move
(
value
));
pending_ops
.
emplace
([
=
](
SecureDht
&
dht
)
{
pending_ops
.
emplace
([
=
](
SecureDht
&
dht
)
{
dht
.
put
(
hash
,
sv
,
cb
,
{}
,
permanent
);
dht
.
put
(
hash
,
sv
,
cb
,
created
,
permanent
);
});
});
cv
.
notify_all
();
cv
.
notify_all
();
}
}
void
void
DhtRunner
::
put
(
InfoHash
hash
,
std
::
shared_ptr
<
Value
>
value
,
DoneCallback
cb
,
bool
permanent
)
DhtRunner
::
put
(
InfoHash
hash
,
std
::
shared_ptr
<
Value
>
value
,
DoneCallback
cb
,
time_point
created
,
bool
permanent
)
{
{
std
::
lock_guard
<
std
::
mutex
>
lck
(
storage_mtx
);
std
::
lock_guard
<
std
::
mutex
>
lck
(
storage_mtx
);
pending_ops
.
emplace
([
=
](
SecureDht
&
dht
)
{
pending_ops
.
emplace
([
=
](
SecureDht
&
dht
)
{
dht
.
put
(
hash
,
value
,
cb
,
{}
,
permanent
);
dht
.
put
(
hash
,
value
,
cb
,
created
,
permanent
);
});
});
cv
.
notify_all
();
cv
.
notify_all
();
}
}
void
void
DhtRunner
::
put
(
const
std
::
string
&
key
,
Value
&&
value
,
DoneCallbackSimple
cb
,
bool
permanent
)
DhtRunner
::
put
(
const
std
::
string
&
key
,
Value
&&
value
,
DoneCallbackSimple
cb
,
time_point
created
,
bool
permanent
)
{
{
put
(
InfoHash
::
get
(
key
),
std
::
forward
<
Value
>
(
value
),
cb
,
permanent
);
put
(
InfoHash
::
get
(
key
),
std
::
forward
<
Value
>
(
value
),
cb
,
created
,
permanent
);
}
}
void
void
...
...
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