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
293662a7
Commit
293662a7
authored
2 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
proxyserver: cleanup, avoid ref-to-temporary
parent
437252bf
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide 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
+11
-20
11 additions, 20 deletions
src/dht_proxy_server.cpp
with
12 additions
and
21 deletions
include/opendht/dht_proxy_server.h
+
1
−
1
View file @
293662a7
...
...
@@ -276,7 +276,7 @@ private:
#ifdef OPENDHT_PUSH_NOTIFICATIONS
PushType
getTypeFromString
(
const
std
::
string
&
type
);
const
std
::
string
&
getDefaultTopic
(
PushType
type
);
std
::
string
getDefaultTopic
(
PushType
type
);
/**
* Subscribe to push notifications for an iOS or Android device.
* Method: SUBSCRIBE "/{InfoHash: .*}"
...
...
This diff is collapsed.
Click to expand it.
src/dht_proxy_server.cpp
+
11
−
20
View file @
293662a7
...
...
@@ -748,30 +748,23 @@ DhtProxyServer::listen(restinio::request_handle_t request,
PushType
DhtProxyServer
::
getTypeFromString
(
const
std
::
string
&
type
)
{
if
(
type
==
"android"
)
{
if
(
type
==
"android"
)
return
PushType
::
Android
;
}
if
(
type
==
"apple"
)
{
// proxy_client is not updated or using ios < 14.5
return
PushType
::
iOSLegacy
;
}
if
(
type
==
"ios"
)
{
else
if
(
type
==
"ios"
)
return
PushType
::
iOS
;
}
else
if
(
type
==
"apple"
)
return
PushType
::
iOSLegacy
;
// proxy_client is not updated or using ios < 14.5
return
PushType
::
None
;
}
const
std
::
string
&
std
::
string
DhtProxyServer
::
getDefaultTopic
(
PushType
type
)
{
if
(
bundleId_
.
empty
())
{
if
(
bundleId_
.
empty
())
return
{};
}
if
(
type
==
PushType
::
iOSLegacy
)
{
return
bundleId_
+
".voip"
;
}
if
(
type
==
PushType
::
iOS
)
{
if
(
type
==
PushType
::
iOS
)
return
bundleId_
;
}
else
if
(
type
==
PushType
::
iOSLegacy
)
return
bundleId_
+
".voip"
;
return
{};
}
...
...
@@ -1201,14 +1194,12 @@ DhtProxyServer::put(restinio::request_handle_t request,
// cancel permanent put
pput
.
expireTimer
=
std
::
make_unique
<
asio
::
steady_timer
>
(
ctx
,
timeout
);
#ifdef OPENDHT_PUSH_NOTIFICATIONS
if
(
not
pushToken
.
empty
()){
bool
isAndroid
=
platform
==
"android"
;
if
(
not
pushToken
.
empty
())
{
pput
.
pushToken
=
pushToken
;
pput
.
clientId
=
clientId
;
pput
.
type
=
getTypeFromString
(
platform
);
if
(
topic
.
empty
())
{
if
(
topic
.
empty
())
topic
=
getDefaultTopic
(
pput
.
type
);
}
pput
.
topic
=
topic
;
pput
.
sessionCtx
=
std
::
make_shared
<
PushSessionContext
>
(
sessionId
);
// notify push listen expire
...
...
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