Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
5005b7be
Unverified
Commit
5005b7be
authored
Jan 26, 2021
by
Wenjun Si
Committed by
GitHub
Jan 26, 2021
Browse files
Create a new TcpSocket when connection failed (#3840)
parent
0235050e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
src/network/linkers_socket.cpp
src/network/linkers_socket.cpp
+5
-4
No files found.
src/network/linkers_socket.cpp
View file @
5005b7be
...
@@ -197,20 +197,21 @@ void Linkers::Construct() {
...
@@ -197,20 +197,21 @@ void Linkers::Construct() {
int
out_rank
=
it
->
first
;
int
out_rank
=
it
->
first
;
// let smaller rank connect to larger rank
// let smaller rank connect to larger rank
if
(
out_rank
>
rank_
)
{
if
(
out_rank
>
rank_
)
{
TcpSocket
cur_socket
;
int
connect_fail_delay_time
=
connect_fail_retry_first_delay_interval
;
int
connect_fail_delay_time
=
connect_fail_retry_first_delay_interval
;
for
(
int
i
=
0
;
i
<
connect_fail_retry_cnt
;
++
i
)
{
for
(
int
i
=
0
;
i
<
connect_fail_retry_cnt
;
++
i
)
{
TcpSocket
cur_socket
;
if
(
cur_socket
.
Connect
(
client_ips_
[
out_rank
].
c_str
(),
client_ports_
[
out_rank
]))
{
if
(
cur_socket
.
Connect
(
client_ips_
[
out_rank
].
c_str
(),
client_ports_
[
out_rank
]))
{
// send local rank
cur_socket
.
Send
(
reinterpret_cast
<
const
char
*>
(
&
rank_
),
sizeof
(
rank_
));
SetLinker
(
out_rank
,
cur_socket
);
break
;
break
;
}
else
{
}
else
{
Log
::
Warning
(
"Connecting to rank %d failed, waiting for %d milliseconds"
,
out_rank
,
connect_fail_delay_time
);
Log
::
Warning
(
"Connecting to rank %d failed, waiting for %d milliseconds"
,
out_rank
,
connect_fail_delay_time
);
cur_socket
.
Close
();
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
connect_fail_delay_time
));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
milliseconds
(
connect_fail_delay_time
));
connect_fail_delay_time
=
static_cast
<
int
>
(
connect_fail_delay_time
*
connect_fail_retry_delay_factor
);
connect_fail_delay_time
=
static_cast
<
int
>
(
connect_fail_delay_time
*
connect_fail_retry_delay_factor
);
}
}
}
}
// send local rank
cur_socket
.
Send
(
reinterpret_cast
<
const
char
*>
(
&
rank_
),
sizeof
(
rank_
));
SetLinker
(
out_rank
,
cur_socket
);
}
}
}
}
// wait for listener
// wait for listener
...
...
Write
Preview
Markdown
is supported
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