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
9dad7c69
Commit
9dad7c69
authored
11 months ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
peer discovery: cleanup
parent
5cc5b98a
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
src/compat/getif_workaround_android.h
+0
-0
0 additions, 0 deletions
src/compat/getif_workaround_android.h
src/peer_discovery.cpp
+10
-9
10 additions, 9 deletions
src/peer_discovery.cpp
with
10 additions
and
9 deletions
src/getif_workaround_android.h
→
src/
compat/
getif_workaround_android.h
+
0
−
0
View file @
9dad7c69
File moved
This diff is collapsed.
Click to expand it.
src/peer_discovery.cpp
+
10
−
9
View file @
9dad7c69
...
...
@@ -23,7 +23,7 @@
#include
"utils.h"
#ifdef __ANDROID__
#include
"getif_workaround_android.h"
#include
"
compat/
getif_workaround_android.h"
#endif
#include
<asio.hpp>
...
...
@@ -99,18 +99,19 @@ PeerDiscovery::DomainPeerDiscovery::DomainPeerDiscovery(asio::ip::udp domain, in
if
(
domain
.
family
()
==
AF_INET
&&
strcmp
(
e
.
what
(),
"set_option: No such device"
)
==
0
)
{
try
{
sockFd_
.
set_option
(
asio
::
ip
::
udp
::
socket
::
reuse_address
(
true
));
auto
m
y
_interface
=
workaround
::
get_interface
();
sockFd_
.
set_option
(
asio
::
ip
::
multicast
::
outbound_interface
(
m
y
_interface
));
sockFd_
.
set_option
(
asio
::
ip
::
multicast
::
join_group
(
sockAddrSend_
.
address
().
to_v4
(),
m
y
_interface
));
auto
m
c
_interface
=
workaround
::
get_interface
();
sockFd_
.
set_option
(
asio
::
ip
::
multicast
::
outbound_interface
(
m
c
_interface
));
sockFd_
.
set_option
(
asio
::
ip
::
multicast
::
join_group
(
sockAddrSend_
.
address
().
to_v4
(),
m
c
_interface
));
sockFd_
.
bind
({
domain
,
port
});
}
catch
(
const
std
::
exception
&
e
){
if
(
logger_
)
logger_
->
e
(
"an
droid discovery
workaround:
%s
"
,
e
.
what
());
logger_
->
e
rror
(
"
C
an
't start peer discovery using android
workaround:
{}
"
,
e
.
what
());
}
}
else
#endif
if
(
logger_
)
logger_
->
e
(
"Can't start peer discovery for
%s: %s
"
,
logger_
->
e
rror
(
"Can't start peer discovery for
{}: {}
"
,
domain
.
family
()
==
AF_INET
?
"IPv4"
:
"IPv6"
,
e
.
what
());
}
}
...
...
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