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
aa93db4f
Commit
aa93db4f
authored
6 years ago
by
Adrien Béraud
Committed by
Sébastien Blin
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
proxy server: move json to sendPushNotification
parent
683570a3
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/dht_proxy_server.h
+1
-1
1 addition, 1 deletion
include/opendht/dht_proxy_server.h
src/dht_proxy_server.cpp
+7
-7
7 additions, 7 deletions
src/dht_proxy_server.cpp
with
8 additions
and
8 deletions
include/opendht/dht_proxy_server.h
+
1
−
1
View file @
aa93db4f
...
...
@@ -253,7 +253,7 @@ private:
* @param key of the device
* @param json, the content to send
*/
void
sendPushNotification
(
const
std
::
string
&
key
,
const
Json
::
Value
&
json
,
bool
isAndroid
)
const
;
void
sendPushNotification
(
const
std
::
string
&
key
,
Json
::
Value
&
&
json
,
bool
isAndroid
)
const
;
/**
* Remove a push listener between a client and a hash
...
...
This diff is collapsed.
Click to expand it.
src/dht_proxy_server.cpp
+
7
−
7
View file @
aa93db4f
...
...
@@ -478,7 +478,7 @@ DhtProxyServer::subscribe(const std::shared_ptr<restbed::Session>& session)
Json
::
Value
json
;
json
[
"key"
]
=
infoHash
.
toString
();
json
[
"to"
]
=
clientId
;
sendPushNotification
(
pushToken
,
json
,
isAndroid
);
sendPushNotification
(
pushToken
,
std
::
move
(
json
)
,
isAndroid
);
return
true
;
}
);
...
...
@@ -493,7 +493,7 @@ DhtProxyServer::subscribe(const std::shared_ptr<restbed::Session>& session)
Json
::
Value
json
;
json
[
"timeout"
]
=
infoHash
.
toString
();
json
[
"to"
]
=
clientId
;
sendPushNotification
(
pushToken
,
json
,
isAndroid
);
sendPushNotification
(
pushToken
,
std
::
move
(
json
)
,
isAndroid
);
}
);
}
...
...
@@ -571,7 +571,7 @@ DhtProxyServer::cancelPushListen(const std::string& pushToken, const dht::InfoHa
}
void
DhtProxyServer
::
sendPushNotification
(
const
std
::
string
&
token
,
const
Json
::
Value
&
json
,
bool
isAndroid
)
const
DhtProxyServer
::
sendPushNotification
(
const
std
::
string
&
token
,
Json
::
Value
&
&
json
,
bool
isAndroid
)
const
{
if
(
pushServer_
.
empty
())
return
;
...
...
@@ -583,9 +583,9 @@ DhtProxyServer::sendPushNotification(const std::string& token, const Json::Value
Json
::
Value
notification
(
Json
::
objectValue
);
Json
::
Value
tokens
(
Json
::
arrayValue
);
tokens
[
0
]
=
token
;
notification
[
"tokens"
]
=
tokens
;
notification
[
"tokens"
]
=
std
::
move
(
tokens
)
;
notification
[
"platform"
]
=
isAndroid
?
2
:
1
;
notification
[
"data"
]
=
json
;
notification
[
"data"
]
=
std
::
move
(
json
)
;
notification
[
"priority"
]
=
"high"
;
notification
[
"time_to_live"
]
=
600
;
...
...
@@ -593,7 +593,7 @@ DhtProxyServer::sendPushNotification(const std::string& token, const Json::Value
notifications
[
0
]
=
notification
;
Json
::
Value
content
;
content
[
"notifications"
]
=
notifications
;
content
[
"notifications"
]
=
std
::
move
(
notifications
)
;
Json
::
StreamWriterBuilder
wbuilder
;
wbuilder
[
"commentStyle"
]
=
"None"
;
...
...
@@ -694,7 +694,7 @@ DhtProxyServer::put(const std::shared_ptr<restbed::Session>& session)
json
[
"timeout"
]
=
infoHash
.
toString
();
json
[
"to"
]
=
clientId
;
json
[
"vid"
]
=
std
::
to_string
(
vid
);
sendPushNotification
(
pushToken
,
json
,
isAndroid
);
sendPushNotification
(
pushToken
,
std
::
move
(
json
)
,
isAndroid
);
});
}
#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