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
0a70b0f8
Commit
0a70b0f8
authored
3 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
dhtrunner: don't bind port if proxy is used
parent
949cbb9f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/dhtrunner.cpp
+27
-32
27 additions, 32 deletions
src/dhtrunner.cpp
with
27 additions
and
32 deletions
src/dhtrunner.cpp
+
27
−
32
View file @
0a70b0f8
...
@@ -132,22 +132,18 @@ DhtRunner::run(const Config& config, Context&& context)
...
@@ -132,22 +132,18 @@ DhtRunner::run(const Config& config, Context&& context)
if
(
context
.
logger
)
{
if
(
context
.
logger
)
{
logger_
=
context
.
logger
;
logger_
=
context
.
logger
;
logger_
->
d
(
"[runner %p] state changed to Running"
,
this
);
}
}
#ifdef OPENDHT_PROXY_CLIENT
config_
=
config
;
identityAnnouncedCb_
=
context
.
identityAnnouncedCb
;
#endif
if
(
config
.
proxy_server
.
empty
())
{
if
(
not
context
.
sock
)
{
if
(
not
context
.
sock
)
{
context
.
sock
.
reset
(
new
net
::
UdpSocket
(
local4
,
local6
,
context
.
logger
));
context
.
sock
.
reset
(
new
net
::
UdpSocket
(
local4
,
local6
,
context
.
logger
));
}
}
if
(
not
state_path
.
empty
()
and
config
.
proxy_server
.
empty
())
{
std
::
ofstream
outConfig
(
state_path
);
outConfig
<<
context
.
sock
->
getBoundRef
(
AF_INET
).
getPort
()
<<
std
::
endl
;
outConfig
<<
context
.
sock
->
getBoundRef
(
AF_INET6
).
getPort
()
<<
std
::
endl
;
}
if
(
context
.
logger
)
{
logger_
->
d
(
"[runner %p] state changed to Running"
,
this
);
}
context
.
sock
->
setOnReceive
([
&
]
(
net
::
PacketList
&&
pkts
)
{
context
.
sock
->
setOnReceive
([
&
]
(
net
::
PacketList
&&
pkts
)
{
net
::
PacketList
ret
;
net
::
PacketList
ret
;
{
{
...
@@ -166,12 +162,11 @@ DhtRunner::run(const Config& config, Context&& context)
...
@@ -166,12 +162,11 @@ DhtRunner::run(const Config& config, Context&& context)
cv
.
notify_all
();
cv
.
notify_all
();
return
ret
;
return
ret
;
});
});
if
(
not
state_path
.
empty
())
{
#ifdef OPENDHT_PROXY_CLIENT
std
::
ofstream
outConfig
(
state_path
);
config_
=
config
;
outConfig
<<
context
.
sock
->
getBoundRef
(
AF_INET
).
getPort
()
<<
std
::
endl
;
identityAnnouncedCb_
=
context
.
identityAnnouncedCb
;
outConfig
<<
context
.
sock
->
getBoundRef
(
AF_INET6
).
getPort
()
<<
std
::
endl
;
#endif
}
if
(
config
.
proxy_server
.
empty
())
{
auto
dht
=
std
::
make_unique
<
Dht
>
(
std
::
move
(
context
.
sock
),
SecureDht
::
getConfig
(
config
.
dht_config
),
context
.
logger
);
auto
dht
=
std
::
make_unique
<
Dht
>
(
std
::
move
(
context
.
sock
),
SecureDht
::
getConfig
(
config
.
dht_config
),
context
.
logger
);
dht_
=
std
::
make_unique
<
SecureDht
>
(
std
::
move
(
dht
),
config
.
dht_config
,
std
::
move
(
context
.
identityAnnouncedCb
),
context
.
logger
);
dht_
=
std
::
make_unique
<
SecureDht
>
(
std
::
move
(
dht
),
config
.
dht_config
,
std
::
move
(
context
.
identityAnnouncedCb
),
context
.
logger
);
}
else
{
}
else
{
...
...
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