Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
619b80ae
Commit
619b80ae
authored
May 09, 2018
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean unused code & comments in connection helper
parent
2fd7996b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
26 deletions
+10
-26
libcaf_io/src/connection_helper.cpp
libcaf_io/src/connection_helper.cpp
+10
-26
No files found.
libcaf_io/src/connection_helper.cpp
View file @
619b80ae
...
@@ -60,7 +60,7 @@ behavior datagram_connection_broker(broker* self, uint16_t port,
...
@@ -60,7 +60,7 @@ behavior datagram_connection_broker(broker* self, uint16_t port,
},
},
after
(
autoconnect_timeout
)
>>
[
=
]()
{
after
(
autoconnect_timeout
)
>>
[
=
]()
{
CAF_LOG_TRACE
(
CAF_ARG
(
""
));
CAF_LOG_TRACE
(
CAF_ARG
(
""
));
//
nothing heard in about 10 minutes... just call it a day, then
//
Nothing heard in about 10 minutes... just call it a day, then.
CAF_LOG_INFO
(
"aborted direct connection attempt after 10min"
);
CAF_LOG_INFO
(
"aborted direct connection attempt after 10min"
);
self
->
quit
(
exit_reason
::
user_shutdown
);
self
->
quit
(
exit_reason
::
user_shutdown
);
}
}
...
@@ -76,7 +76,7 @@ bool establish_stream_connection(stateful_actor<connection_helper_state>* self,
...
@@ -76,7 +76,7 @@ bool establish_stream_connection(stateful_actor<connection_helper_state>* self,
for
(
auto
&
addr
:
kvp
.
second
)
{
for
(
auto
&
addr
:
kvp
.
second
)
{
auto
hdl
=
mx
.
new_tcp_scribe
(
addr
,
port
);
auto
hdl
=
mx
.
new_tcp_scribe
(
addr
,
port
);
if
(
hdl
)
{
if
(
hdl
)
{
//
gotcha! s
end scribe to our BASP broker
//
Gotcha! S
end scribe to our BASP broker
// to initiate handshake etc.
// to initiate handshake etc.
CAF_LOG_INFO
(
"connected directly:"
<<
CAF_ARG
(
addr
));
CAF_LOG_INFO
(
"connected directly:"
<<
CAF_ARG
(
addr
));
self
->
send
(
b
,
connect_atom
::
value
,
*
hdl
,
port
);
self
->
send
(
b
,
connect_atom
::
value
,
*
hdl
,
port
);
...
@@ -96,33 +96,17 @@ behavior connection_helper(stateful_actor<connection_helper_state>* self,
...
@@ -96,33 +96,17 @@ behavior connection_helper(stateful_actor<connection_helper_state>* self,
self
->
quit
(
std
::
move
(
dm
.
reason
));
self
->
quit
(
std
::
move
(
dm
.
reason
));
});
});
return
{
return
{
//
this config is send from the remote `ConfigServ`
//
This config is send from the remote `PeerServ`.
[
=
](
const
std
::
string
&
item
,
message
&
msg
)
{
[
=
](
const
std
::
string
&
item
,
message
&
msg
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
item
)
<<
CAF_ARG
(
msg
));
CAF_LOG_TRACE
(
CAF_ARG
(
item
)
<<
CAF_ARG
(
msg
));
CAF_LOG_DEBUG
(
"received requested config:"
<<
CAF_ARG
(
msg
));
CAF_LOG_DEBUG
(
"received requested config:"
<<
CAF_ARG
(
msg
));
// whatever happens, we are done afterwards
if
(
item
.
empty
()
||
msg
.
empty
())
{
CAF_LOG_DEBUG
(
"skipping empty info"
);
return
;
}
// Whatever happens, we are done afterwards.
self
->
quit
();
self
->
quit
();
msg
.
apply
({
msg
.
apply
({
[
&
](
uint16_t
port
,
network
::
address_listing
&
addresses
)
{
if
(
item
==
"basp.default-connectivity-tcp"
)
{
if
(
!
establish_stream_connection
(
self
,
b
,
port
,
addresses
))
CAF_LOG_INFO
(
"could not connect to node"
);
}
else
if
(
item
==
"basp.default-connectivity-udp"
)
{
// create new broker to try addresses for communication via UDP
if
(
self
->
system
().
config
().
middleman_detach_utility_actors
)
{
self
->
system
().
middleman
().
spawn_broker
<
detached
+
hidden
>
(
datagram_connection_broker
,
port
,
std
::
move
(
addresses
),
b
,
i
);
}
else
{
self
->
system
().
middleman
().
spawn_broker
<
hidden
>
(
datagram_connection_broker
,
port
,
std
::
move
(
addresses
),
b
,
i
);
}
}
else
{
CAF_LOG_INFO
(
"aborted direct connection attempt, unknown item: "
<<
CAF_ARG
(
item
));
}
},
[
&
](
basp
::
routing_table
::
address_map
&
addrs
)
{
[
&
](
basp
::
routing_table
::
address_map
&
addrs
)
{
if
(
addrs
.
count
(
network
::
protocol
::
tcp
)
>
0
)
{
if
(
addrs
.
count
(
network
::
protocol
::
tcp
)
>
0
)
{
auto
eps
=
addrs
[
network
::
protocol
::
tcp
];
auto
eps
=
addrs
[
network
::
protocol
::
tcp
];
...
@@ -131,7 +115,7 @@ behavior connection_helper(stateful_actor<connection_helper_state>* self,
...
@@ -131,7 +115,7 @@ behavior connection_helper(stateful_actor<connection_helper_state>* self,
}
}
if
(
addrs
.
count
(
network
::
protocol
::
udp
)
>
0
)
{
if
(
addrs
.
count
(
network
::
protocol
::
udp
)
>
0
)
{
auto
eps
=
addrs
[
network
::
protocol
::
udp
];
auto
eps
=
addrs
[
network
::
protocol
::
udp
];
//
create new broker to try addresses for communication via UDP
//
Create new broker to try addresses for communication via UDP.
if
(
self
->
system
().
config
().
middleman_detach_utility_actors
)
{
if
(
self
->
system
().
config
().
middleman_detach_utility_actors
)
{
self
->
system
().
middleman
().
spawn_broker
<
detached
+
hidden
>
(
self
->
system
().
middleman
().
spawn_broker
<
detached
+
hidden
>
(
datagram_connection_broker
,
eps
.
first
,
std
::
move
(
eps
.
second
),
b
,
i
datagram_connection_broker
,
eps
.
first
,
std
::
move
(
eps
.
second
),
b
,
i
...
@@ -147,7 +131,7 @@ behavior connection_helper(stateful_actor<connection_helper_state>* self,
...
@@ -147,7 +131,7 @@ behavior connection_helper(stateful_actor<connection_helper_state>* self,
},
},
after
(
autoconnect_timeout
)
>>
[
=
]
{
after
(
autoconnect_timeout
)
>>
[
=
]
{
CAF_LOG_TRACE
(
CAF_ARG
(
""
));
CAF_LOG_TRACE
(
CAF_ARG
(
""
));
//
nothing heard in about 10 minutes... just a call it a day, then
//
Nothing heard in about 10 minutes... just a call it a day, then.
CAF_LOG_INFO
(
"aborted direct connection attempt after 10min"
);
CAF_LOG_INFO
(
"aborted direct connection attempt after 10min"
);
self
->
quit
(
exit_reason
::
user_shutdown
);
self
->
quit
(
exit_reason
::
user_shutdown
);
}
}
...
...
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