Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Jenny Ryan
ouinet
Commits
ea50f34c
Commit
ea50f34c
authored
Dec 14, 2020
by
Ivan Vilata-i-Balaguer
Browse files
Do dump announced groups to font-end's `/groups.txt`.
As plain text, one per line, undefined ordering.
parent
15f6cda1
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/cache/client.cpp
View file @
ea50f34c
...
...
@@ -514,6 +514,10 @@ struct Client::Impl {
return
*
_newest_proto_seen
;
}
std
::
set
<
std
::
string
>
get_announced_groups
()
const
{
return
_dht_groups
->
groups
();
}
void
set_log_level
(
log_level_t
l
)
{
cerr
<<
"Setting cache/client Cache log level to "
<<
l
<<
"
\n
"
;
_log_level
=
l
;
...
...
@@ -608,6 +612,11 @@ unsigned Client::get_newest_proto_version() const
return
_impl
->
get_newest_proto_version
();
}
std
::
set
<
std
::
string
>
Client
::
get_announced_groups
()
const
{
return
_impl
->
get_announced_groups
();
}
void
Client
::
set_log_level
(
log_level_t
l
)
{
_impl
->
set_log_level
(
l
);
...
...
src/cache/client.h
View file @
ea50f34c
...
...
@@ -7,6 +7,7 @@
#include "cache_entry.h"
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/filesystem.hpp>
#include <set>
namespace
ouinet
{
...
...
@@ -59,6 +60,10 @@ public:
// (e.g. to warn about potential upgrades).
unsigned
get_newest_proto_version
()
const
;
// Get all groups being announced to the distributed cache index
// by this client.
std
::
set
<
std
::
string
>
get_announced_groups
()
const
;
~
Client
();
void
set_log_level
(
log_level_t
);
...
...
src/client_front_end.cpp
View file @
ea50f34c
...
...
@@ -182,11 +182,15 @@ static void load_log_file(stringstream& out_ss) {
void
ClientFrontEnd
::
handle_group_list
(
const
Request
&
,
Response
&
res
,
std
::
stringstream
&
ss
)
,
std
::
stringstream
&
ss
,
cache
::
Client
*
cache_client
)
{
res
.
set
(
http
::
field
::
content_type
,
"text/plain"
);
ss
<<
"TODO
\n
"
;
if
(
!
cache_client
)
return
;
for
(
const
auto
&
g
:
cache_client
->
get_announced_groups
())
ss
<<
g
<<
std
::
endl
;
}
void
ClientFrontEnd
::
handle_portal
(
ClientConfig
&
config
...
...
@@ -463,7 +467,7 @@ Response ClientFrontEnd::serve( ClientConfig& config
res
.
set
(
http
::
field
::
content_type
,
"text/plain"
);
load_log_file
(
ss
);
}
else
if
(
path
==
group_list_apath
)
{
handle_group_list
(
req
,
res
,
ss
);
handle_group_list
(
req
,
res
,
ss
,
cache_client
);
}
else
if
(
path
==
"/api/status"
)
{
sys
::
error_code
e
;
handle_status
(
config
,
udp_port
,
upnps
,
reachability
...
...
src/client_front_end.h
View file @
ea50f34c
...
...
@@ -102,7 +102,8 @@ private:
void
handle_group_list
(
const
Request
&
,
Response
&
,
std
::
stringstream
&
);
,
std
::
stringstream
&
,
cache
::
Client
*
);
void
handle_portal
(
ClientConfig
&
,
const
Request
&
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment