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
13194b66
Commit
13194b66
authored
1 year ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
proxy client: retry permanent put after reconnect
parent
601758f5
Branches
Branches containing commit
Tags
v3.0.1
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dht_proxy_client.cpp
+10
-5
10 additions, 5 deletions
src/dht_proxy_client.cpp
with
10 additions
and
5 deletions
src/dht_proxy_client.cpp
+
10
−
5
View file @
13194b66
...
...
@@ -491,7 +491,7 @@ void
DhtProxyClient
::
doPut
(
const
InfoHash
&
key
,
Sp
<
Value
>
val
,
DoneCallbackSimple
cb
,
time_point
/*created*/
,
bool
permanent
)
{
if
(
logger_
)
logger_
->
d
(
"[proxy:client] [put] [search
%s
] executing for
%s
"
,
key
.
to_c_str
()
,
val
->
toString
()
.
c_str
()
);
logger_
->
d
ebug
(
"[proxy:client] [put] [search
{}
] executing for
{}
"
,
key
,
val
->
toString
());
try
{
auto
request
=
buildRequest
(
"/key/"
+
key
.
toString
());
...
...
@@ -539,12 +539,12 @@ DhtProxyClient::doPut(const InfoHash& key, Sp<Value> val, DoneCallbackSimple cb,
}
}
else
{
if
(
logger_
)
logger_
->
e
(
"[proxy:client] [
status
] failed to parse value from
server
"
,
response
.
status_code
);
logger_
->
e
rror
(
"[proxy:client] [
put
] failed to parse value from server
: {}"
,
err
);
}
}
}
else
{
if
(
logger_
)
logger_
->
e
(
"[proxy:client] [
status
] failed with code=
%i
"
,
response
.
status_code
);
logger_
->
e
rror
(
"[proxy:client] [
put
] failed with code=
{:d}
"
,
response
.
status_code
);
if
(
not
response
.
aborted
and
response
.
status_code
==
0
)
opFailed
();
}
...
...
@@ -563,7 +563,8 @@ DhtProxyClient::doPut(const InfoHash& key, Sp<Value> val, DoneCallbackSimple cb,
}
catch
(
const
std
::
exception
&
e
){
if
(
logger_
)
logger_
->
e
(
"[proxy:client] [put %s] error: %s"
,
key
.
to_c_str
(),
e
.
what
());
logger_
->
error
(
"[proxy:client] [put {}] error: {}"
,
key
,
e
.
what
());
opFailed
();
}
}
...
...
@@ -1154,7 +1155,7 @@ DhtProxyClient::restartListeners(const asio::error_code &ec)
std
::
lock_guard
<
std
::
mutex
>
lock
(
searchLock_
);
for
(
auto
&
search
:
searches_
)
{
auto
key
=
search
.
first
;
const
auto
&
key
=
search
.
first
;
for
(
auto
&
put
:
search
.
second
.
puts
)
{
doPut
(
key
,
put
.
second
.
value
,
[
ok
=
put
.
second
.
ok
](
bool
result
){
*
ok
=
result
;
...
...
@@ -1166,6 +1167,10 @@ DhtProxyClient::restartListeners(const asio::error_code &ec)
put
.
second
.
refreshPutTimer
->
async_wait
(
std
::
bind
(
&
DhtProxyClient
::
handleRefreshPut
,
this
,
std
::
placeholders
::
_1
,
key
,
put
.
first
));
}
// Restart failed pending puts
for
(
auto
&
pput
:
search
.
second
.
pendingPuts
)
{
doPut
(
key
,
pput
,
{},
time_point
::
max
(),
true
);
}
}
if
(
not
deviceKey_
.
empty
())
{
if
(
logger_
)
...
...
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