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
39bb5203
Commit
39bb5203
authored
Sep 22, 2022
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
proxy server: don't send refresh notification for non-push operations
parent
18e53b9e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dht_proxy_server.cpp
+23
-21
23 additions, 21 deletions
src/dht_proxy_server.cpp
with
23 additions
and
21 deletions
src/dht_proxy_server.cpp
+
23
−
21
View file @
39bb5203
...
@@ -415,7 +415,7 @@ DhtProxyServer::loadState(Is& is, size_t size) {
...
@@ -415,7 +415,7 @@ DhtProxyServer::loadState(Is& is, size_t size) {
json
[
"s"
]
=
sessionCtx
->
sessionId
;
json
[
"s"
]
=
sessionCtx
->
sessionId
;
}
}
if
(
expired
and
values
.
size
()
<
2
){
if
(
expired
and
values
.
size
()
<
2
){
std
::
stringstream
ss
;
std
::
o
stringstream
ss
;
for
(
size_t
i
=
0
;
i
<
values
.
size
();
++
i
){
for
(
size_t
i
=
0
;
i
<
values
.
size
();
++
i
){
if
(
i
!=
0
)
ss
<<
","
;
if
(
i
!=
0
)
ss
<<
","
;
ss
<<
values
[
i
]
->
id
;
ss
<<
values
[
i
]
->
id
;
...
@@ -892,7 +892,7 @@ DhtProxyServer::subscribe(restinio::request_handle_t request,
...
@@ -892,7 +892,7 @@ DhtProxyServer::subscribe(restinio::request_handle_t request,
json
[
"s"
]
=
sessionCtx
->
sessionId
;
json
[
"s"
]
=
sessionCtx
->
sessionId
;
}
}
if
(
expired
and
values
.
size
()
<
2
){
if
(
expired
and
values
.
size
()
<
2
){
std
::
stringstream
ss
;
std
::
o
stringstream
ss
;
for
(
size_t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
for
(
size_t
i
=
0
;
i
<
values
.
size
();
++
i
)
{
if
(
i
!=
0
)
ss
<<
","
;
if
(
i
!=
0
)
ss
<<
","
;
ss
<<
values
[
i
]
->
id
;
ss
<<
values
[
i
]
->
id
;
...
@@ -967,7 +967,7 @@ DhtProxyServer::handleNotifyPushListenExpire(const asio::error_code &ec, const s
...
@@ -967,7 +967,7 @@ DhtProxyServer::handleNotifyPushListenExpire(const asio::error_code &ec, const s
logger_
->
e
(
"[proxy:server] [subscribe] error sending put refresh: %s"
,
ec
.
message
().
c_str
());
logger_
->
e
(
"[proxy:server] [subscribe] error sending put refresh: %s"
,
ec
.
message
().
c_str
());
}
}
if
(
logger_
)
if
(
logger_
)
logger_
->
d
(
"[proxy:server] [subscribe] sending
put
refresh to %s token"
,
pushToken
.
c_str
());
logger_
->
d
(
"[proxy:server] [subscribe] sending refresh to %s token"
,
pushToken
.
c_str
());
sendPushNotification
(
pushToken
,
jsonProvider
(),
type
,
false
,
topic
);
sendPushNotification
(
pushToken
,
jsonProvider
(),
type
,
false
,
topic
);
}
}
...
@@ -1217,6 +1217,7 @@ DhtProxyServer::put(restinio::request_handle_t request,
...
@@ -1217,6 +1217,7 @@ DhtProxyServer::put(restinio::request_handle_t request,
#ifdef OPENDHT_PUSH_NOTIFICATIONS
#ifdef OPENDHT_PUSH_NOTIFICATIONS
// notify put permanent expiration
// notify put permanent expiration
if
(
pput
.
sessionCtx
)
{
auto
jsonProvider
=
[
infoHash
,
clientId
,
vid
,
sessionCtx
=
pput
.
sessionCtx
](){
auto
jsonProvider
=
[
infoHash
,
clientId
,
vid
,
sessionCtx
=
pput
.
sessionCtx
](){
Json
::
Value
json
;
Json
::
Value
json
;
json
[
"timeout"
]
=
infoHash
.
toString
();
json
[
"timeout"
]
=
infoHash
.
toString
();
...
@@ -1234,6 +1235,7 @@ DhtProxyServer::put(restinio::request_handle_t request,
...
@@ -1234,6 +1235,7 @@ DhtProxyServer::put(restinio::request_handle_t request,
pput
.
expireNotifyTimer
->
async_wait
(
std
::
bind
(
pput
.
expireNotifyTimer
->
async_wait
(
std
::
bind
(
&
DhtProxyServer
::
handleNotifyPushListenExpire
,
this
,
&
DhtProxyServer
::
handleNotifyPushListenExpire
,
this
,
std
::
placeholders
::
_1
,
pushToken
,
std
::
move
(
jsonProvider
),
pput
.
type
,
pput
.
topic
));
std
::
placeholders
::
_1
,
pushToken
,
std
::
move
(
jsonProvider
),
pput
.
type
,
pput
.
topic
));
}
#endif
#endif
}
}
...
...
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