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
8b90c473
Commit
8b90c473
authored
7 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
proxy server: add logs
parent
fae6b138
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dht_proxy_server.cpp
+5
-0
5 additions, 0 deletions
src/dht_proxy_server.cpp
with
5 additions
and
0 deletions
src/dht_proxy_server.cpp
+
5
−
0
View file @
8b90c473
...
...
@@ -360,6 +360,8 @@ DhtProxyServer::subscribe(const std::shared_ptr<restbed::Session>& session)
auto
isAndroid
=
platform
==
"android"
;
auto
clientId
=
root
.
isMember
(
"client_id"
)
?
root
[
"client_id"
].
asString
()
:
std
::
string
();
std
::
cout
<<
"Subscribe "
<<
infoHash
<<
" token:"
<<
tokenFromReq
<<
" client:"
<<
clientId
<<
std
::
endl
;
{
std
::
lock_guard
<
std
::
mutex
>
lock
(
lockListener_
);
// Check if listener is already present and refresh timeout if launched
...
...
@@ -578,6 +580,7 @@ DhtProxyServer::put(const std::shared_ptr<restbed::Session>& session)
// Build the Value from json
auto
value
=
std
::
make_shared
<
Value
>
(
root
);
auto
permanent
=
root
.
isMember
(
"permanent"
);
std
::
cout
<<
"Got put "
<<
infoHash
<<
" "
<<
value
<<
" "
<<
(
permanent
?
"permanent"
:
""
)
<<
std
::
endl
;
if
(
permanent
)
{
std
::
string
pushToken
,
clientId
,
platform
;
...
...
@@ -596,6 +599,7 @@ DhtProxyServer::put(const std::shared_ptr<restbed::Session>& session)
auto
r
=
sPuts
->
second
.
puts
.
emplace
(
vid
,
PermanentPut
{});
if
(
r
.
second
)
{
r
.
first
->
second
.
expireJob
=
scheduler_
.
add
(
timeout
,
[
this
,
infoHash
,
vid
]{
std
::
cout
<<
"Permanent put expired"
<<
infoHash
<<
std
::
endl
;
cancelPut
(
infoHash
,
vid
);
});
#if OPENDHT_PUSH_NOTIFICATIONS
...
...
@@ -603,6 +607,7 @@ DhtProxyServer::put(const std::shared_ptr<restbed::Session>& session)
r
.
first
->
second
.
expireNotifyJob
=
scheduler_
.
add
(
timeout
-
proxy
::
OP_MARGIN
,
[
this
,
infoHash
,
vid
,
pushToken
,
clientId
,
isAndroid
]
{
std
::
cout
<<
"Permanent put refresh"
<<
infoHash
<<
std
::
endl
;
Json
::
Value
json
;
json
[
"timeout"
]
=
infoHash
.
toString
();
json
[
"to"
]
=
clientId
;
...
...
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