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
374fdd6c
Commit
374fdd6c
authored
Dec 14, 2019
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
proxy: send normal priority push message for value expiration
parent
54b1314a
Branches
Branches containing commit
Tags
Tags containing commit
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
+4
-4
4 additions, 4 deletions
src/dht_proxy_server.cpp
with
5 additions
and
5 deletions
include/opendht/dht_proxy_server.h
+
1
−
1
View file @
374fdd6c
...
@@ -281,7 +281,7 @@ private:
...
@@ -281,7 +281,7 @@ private:
* @param key of the device
* @param key of the device
* @param json, the content to send
* @param json, the content to send
*/
*/
void
sendPushNotification
(
const
std
::
string
&
key
,
Json
::
Value
&&
json
,
bool
isAndroid
);
void
sendPushNotification
(
const
std
::
string
&
key
,
Json
::
Value
&&
json
,
bool
isAndroid
,
bool
highPriority
);
/**
/**
* Send push notification with an expire timeout.
* Send push notification with an expire timeout.
...
...
This diff is collapsed.
Click to expand it.
src/dht_proxy_server.cpp
+
4
−
4
View file @
374fdd6c
...
@@ -706,7 +706,7 @@ DhtProxyServer::subscribe(restinio::request_handle_t request,
...
@@ -706,7 +706,7 @@ DhtProxyServer::subscribe(restinio::request_handle_t request,
}
}
json
[
"exp"
]
=
ss
.
str
();
json
[
"exp"
]
=
ss
.
str
();
}
}
sendPushNotification
(
pushToken
,
std
::
move
(
json
),
isAndroid
);
sendPushNotification
(
pushToken
,
std
::
move
(
json
),
isAndroid
,
!
expired
);
return
true
;
return
true
;
}
}
);
);
...
@@ -802,7 +802,7 @@ DhtProxyServer::handleNotifyPushListenExpire(const asio::error_code &ec, const s
...
@@ -802,7 +802,7 @@ DhtProxyServer::handleNotifyPushListenExpire(const asio::error_code &ec, const s
}
}
if
(
logger_
)
if
(
logger_
)
logger_
->
d
(
"[proxy:server] [subscribe] sending put refresh to %s token"
,
pushToken
.
c_str
());
logger_
->
d
(
"[proxy:server] [subscribe] sending put refresh to %s token"
,
pushToken
.
c_str
());
sendPushNotification
(
pushToken
,
std
::
move
(
json
),
isAndroid
);
sendPushNotification
(
pushToken
,
std
::
move
(
json
),
isAndroid
,
false
);
}
}
void
void
...
@@ -844,7 +844,7 @@ DhtProxyServer::handleCancelPushListen(const asio::error_code &ec, const std::st
...
@@ -844,7 +844,7 @@ DhtProxyServer::handleCancelPushListen(const asio::error_code &ec, const std::st
}
}
void
void
DhtProxyServer
::
sendPushNotification
(
const
std
::
string
&
token
,
Json
::
Value
&&
json
,
bool
isAndroid
)
DhtProxyServer
::
sendPushNotification
(
const
std
::
string
&
token
,
Json
::
Value
&&
json
,
bool
isAndroid
,
bool
highPriority
)
{
{
if
(
pushServer_
.
empty
())
if
(
pushServer_
.
empty
())
return
;
return
;
...
@@ -868,7 +868,7 @@ DhtProxyServer::sendPushNotification(const std::string& token, Json::Value&& jso
...
@@ -868,7 +868,7 @@ DhtProxyServer::sendPushNotification(const std::string& token, Json::Value&& jso
notification
[
"tokens"
]
=
std
::
move
(
tokens
);
notification
[
"tokens"
]
=
std
::
move
(
tokens
);
notification
[
"platform"
]
=
isAndroid
?
2
:
1
;
notification
[
"platform"
]
=
isAndroid
?
2
:
1
;
notification
[
"data"
]
=
std
::
move
(
json
);
notification
[
"data"
]
=
std
::
move
(
json
);
notification
[
"priority"
]
=
"
high"
;
notification
[
"priority"
]
=
high
Priority
?
"high"
:
"normal
"
;
notification
[
"time_to_live"
]
=
600
;
notification
[
"time_to_live"
]
=
600
;
Json
::
Value
notifications
(
Json
::
arrayValue
);
Json
::
Value
notifications
(
Json
::
arrayValue
);
...
...
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