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
fcac10c4
Unverified
Commit
fcac10c4
authored
7 years ago
by
Sébastien Blin
Browse files
Options
Downloads
Patches
Plain Diff
proxyserver: fix cancelListen and reduce push notifications number
parent
22ef53ac
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_proxy_server.cpp
+2
-3
2 additions, 3 deletions
src/dht_proxy_server.cpp
with
2 additions
and
3 deletions
src/dht_proxy_server.cpp
+
2
−
3
View file @
fcac10c4
...
@@ -343,7 +343,6 @@ DhtProxyServer::unsubscribe(const std::shared_ptr<restbed::Session>& session) co
...
@@ -343,7 +343,6 @@ DhtProxyServer::unsubscribe(const std::shared_ptr<restbed::Session>& session) co
try
{
try
{
restbed
::
Bytes
buf
(
b
);
restbed
::
Bytes
buf
(
b
);
std
::
string
strJson
(
buf
.
begin
(),
buf
.
end
());
std
::
string
strJson
(
buf
.
begin
(),
buf
.
end
());
std
::
string
err
;
std
::
string
err
;
Json
::
Value
root
;
Json
::
Value
root
;
Json
::
CharReaderBuilder
rbuilder
;
Json
::
CharReaderBuilder
rbuilder
;
...
@@ -355,7 +354,7 @@ DhtProxyServer::unsubscribe(const std::shared_ptr<restbed::Session>& session) co
...
@@ -355,7 +354,7 @@ DhtProxyServer::unsubscribe(const std::shared_ptr<restbed::Session>& session) co
}
}
auto
pushToken
=
root
[
"key"
].
asString
();
auto
pushToken
=
root
[
"key"
].
asString
();
if
(
pushToken
.
empty
())
return
;
if
(
pushToken
.
empty
())
return
;
auto
token
=
root
[
"token"
].
as
LargestUInt
(
);
auto
token
=
std
::
stoull
(
root
[
"token"
].
as
String
()
);
if
(
token
==
0
)
return
;
if
(
token
==
0
)
return
;
auto
callbackId
=
root
.
isMember
(
"callback_id"
)
?
root
[
"callback_id"
].
asLargestUInt
()
:
0
;
auto
callbackId
=
root
.
isMember
(
"callback_id"
)
?
root
[
"callback_id"
].
asLargestUInt
()
:
0
;
...
@@ -430,7 +429,7 @@ DhtProxyServer::handlePushListeners()
...
@@ -430,7 +429,7 @@ DhtProxyServer::handlePushListeners()
auto
isAndroid
=
pushListener
->
isAndroid
;
auto
isAndroid
=
pushListener
->
isAndroid
;
auto
clientId
=
pushListener
->
clientId
;
auto
clientId
=
pushListener
->
clientId
;
pushListener
->
internalToken
=
dht_
->
listen
(
pushListener
->
hash
,
pushListener
->
internalToken
=
dht_
->
listen
(
pushListener
->
hash
,
[
this
,
key
,
callbackId
,
token
,
isAndroid
,
clientId
](
std
::
shared_ptr
<
Value
>
/*value*/
)
{
[
this
,
key
,
callbackId
,
token
,
isAndroid
,
clientId
](
std
::
vector
<
std
::
shared_ptr
<
Value
>
>
/*value*/
)
{
// Build message content.
// Build message content.
Json
::
Value
json
;
Json
::
Value
json
;
if
(
callbackId
>
0
)
{
if
(
callbackId
>
0
)
{
...
...
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