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
bf227239
Commit
bf227239
authored
Nov 18, 2016
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Udp handshake received, not answered
parent
f6fbd101
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
325 additions
and
18 deletions
+325
-18
libcaf_io/caf/io/basp/header.hpp
libcaf_io/caf/io/basp/header.hpp
+3
-1
libcaf_io/caf/io/basp/message_type.hpp
libcaf_io/caf/io/basp/message_type.hpp
+4
-0
libcaf_io/caf/io/dgram_doorman_handle.hpp
libcaf_io/caf/io/dgram_doorman_handle.hpp
+1
-1
libcaf_io/src/basp_broker.cpp
libcaf_io/src/basp_broker.cpp
+11
-10
libcaf_io/src/dgram_doorman.cpp
libcaf_io/src/dgram_doorman.cpp
+2
-2
libcaf_io/src/header.cpp
libcaf_io/src/header.cpp
+20
-0
libcaf_io/src/instance.cpp
libcaf_io/src/instance.cpp
+284
-4
No files found.
libcaf_io/caf/io/basp/header.hpp
View file @
bf227239
...
@@ -102,7 +102,9 @@ inline bool operator!=(const header& lhs, const header& rhs) {
...
@@ -102,7 +102,9 @@ inline bool operator!=(const header& lhs, const header& rhs) {
/// Checks whether given header contains a handshake.
/// Checks whether given header contains a handshake.
inline
bool
is_handshake
(
const
header
&
hdr
)
{
inline
bool
is_handshake
(
const
header
&
hdr
)
{
return
hdr
.
operation
==
message_type
::
server_handshake
return
hdr
.
operation
==
message_type
::
server_handshake
||
hdr
.
operation
==
message_type
::
client_handshake
;
||
hdr
.
operation
==
message_type
::
client_handshake
||
hdr
.
operation
==
message_type
::
udp_client_handshake
||
hdr
.
operation
==
message_type
::
udp_server_handshake
;
}
}
/// Checks wheter given header contains a heartbeat.
/// Checks wheter given header contains a heartbeat.
...
...
libcaf_io/caf/io/basp/message_type.hpp
View file @
bf227239
...
@@ -69,6 +69,10 @@ enum class message_type : uint8_t {
...
@@ -69,6 +69,10 @@ enum class message_type : uint8_t {
///
///
/// 
/// 
heartbeat
=
0x05
,
heartbeat
=
0x05
,
// TODO: udp handshakes
udp_client_handshake
=
0x06
,
udp_server_handshake
=
0x07
};
};
/// @relates message_type
/// @relates message_type
...
...
libcaf_io/caf/io/dgram_doorman_handle.hpp
View file @
bf227239
libcaf_io/src/basp_broker.cpp
View file @
bf227239
...
@@ -597,7 +597,11 @@ behavior basp_broker::make_behavior() {
...
@@ -597,7 +597,11 @@ behavior basp_broker::make_behavior() {
<<
CAF_ARG
(
msg
.
handle
));
<<
CAF_ARG
(
msg
.
handle
));
ctx
.
callback
->
deliver
(
make_error
(
sec
::
disconnect_during_handshake
));
ctx
.
callback
->
deliver
(
make_error
(
sec
::
disconnect_during_handshake
));
}
}
// TODO: some error?
}
else
{
}
else
{
if
(
ctx
.
callback
)
{
// TODO: if callback available, handle that
}
// TODO: Is there configuration necessary?
// TODO: Is there configuration necessary?
// configure_datagram_size(...);
// configure_datagram_size(...);
}
}
...
@@ -693,9 +697,11 @@ behavior basp_broker::make_behavior() {
...
@@ -693,9 +697,11 @@ behavior basp_broker::make_behavior() {
// flush(msg.handle);
// flush(msg.handle);
// TODO: is this right?
// TODO: is this right?
},
},
/*
[=](const dgram_delegate_msg&) {
[=](const dgram_delegate_msg&) {
std
::
cerr
<<
"[BB] Received new delegate message"
<<
std
::
endl
;
CAF_LOG_TRACE(CAF_ARG(msg.handle));
},
},
*/
// received from underlying broker implementation
// received from underlying broker implementation
[
=
](
const
dgram_scribe_closed_msg
&
msg
)
{
[
=
](
const
dgram_scribe_closed_msg
&
msg
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
msg
.
handle
));
CAF_LOG_TRACE
(
CAF_ARG
(
msg
.
handle
));
...
@@ -709,12 +715,6 @@ behavior basp_broker::make_behavior() {
...
@@ -709,12 +715,6 @@ behavior basp_broker::make_behavior() {
CAF_ASSERT
(
nid
==
none
CAF_ASSERT
(
nid
==
none
||
!
state
.
instance
.
tbl
().
reachable
(
nid
));
||
!
state
.
instance
.
tbl
().
reachable
(
nid
));
},
},
// received from underlying broker implementation
[
=
](
const
dgram_acceptor_closed_msg
&
msg
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
msg
.
handle
));
auto
port
=
local_port
(
msg
.
handle
);
state
.
instance
.
remove_published_actor
(
port
);
},
[
=
](
const
dgram_doorman_closed_msg
&
msg
)
{
[
=
](
const
dgram_doorman_closed_msg
&
msg
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
msg
.
handle
));
CAF_LOG_TRACE
(
CAF_ARG
(
msg
.
handle
));
std
::
cerr
<<
"[BB] Received dgram_doorman_closed_msg"
<<
std
::
endl
;
std
::
cerr
<<
"[BB] Received dgram_doorman_closed_msg"
<<
std
::
endl
;
...
@@ -777,7 +777,8 @@ behavior basp_broker::make_behavior() {
...
@@ -777,7 +777,8 @@ behavior basp_broker::make_behavior() {
[
=
](
connect_atom
,
dgram_scribe_handle
hdl
,
[
=
](
connect_atom
,
dgram_scribe_handle
hdl
,
const
std
::
string
&
host
,
uint16_t
port
)
{
const
std
::
string
&
host
,
uint16_t
port
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
.
id
()));
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
.
id
()));
std
::
cerr
<<
"[BB] connect for dgram to "
<<
host
<<
":"
<<
port
<<
std
::
endl
;
std
::
cerr
<<
"[BB]
\"
connect
\"
for dgram to "
<<
host
<<
":"
<<
port
<<
std
::
endl
;
auto
rp
=
make_response_promise
();
auto
rp
=
make_response_promise
();
auto
res
=
assign_dgram_scribe
(
hdl
,
host
,
port
);
auto
res
=
assign_dgram_scribe
(
hdl
,
host
,
port
);
if
(
res
)
{
if
(
res
)
{
...
@@ -786,8 +787,8 @@ behavior basp_broker::make_behavior() {
...
@@ -786,8 +787,8 @@ behavior basp_broker::make_behavior() {
ctx
.
remote_port
=
port
;
ctx
.
remote_port
=
port
;
ctx
.
callback
=
rp
;
ctx
.
callback
=
rp
;
auto
&
bi
=
state
.
instance
;
auto
&
bi
=
state
.
instance
;
//bi.write_server_handshake(context(), wr_buf(hdl), port);
//
bi.write_server_handshake(context(), wr_buf(hdl), port);
//bi.write_client_handshake(context(), wr_buf(hdl), local_port(hdl));
//
bi.write_client_handshake(context(), wr_buf(hdl), local_port(hdl));
bi
.
write_udp_client_handshake
(
context
(),
wr_buf
(
hdl
));
bi
.
write_udp_client_handshake
(
context
(),
wr_buf
(
hdl
));
flush
(
hdl
);
flush
(
hdl
);
configure_datagram_size
(
hdl
,
1500
);
configure_datagram_size
(
hdl
,
1500
);
...
...
libcaf_io/src/dgram_doorman.cpp
View file @
bf227239
...
@@ -58,7 +58,7 @@ bool dgram_doorman::delegate_msg(execution_unit* ctx,
...
@@ -58,7 +58,7 @@ bool dgram_doorman::delegate_msg(execution_unit* ctx,
CAF_LOG_TRACE
(
CAF_ARG
(
endpoint
)
<<
CAF_ARG
(
num_bytes
));
CAF_LOG_TRACE
(
CAF_ARG
(
endpoint
)
<<
CAF_ARG
(
num_bytes
));
if
(
detached
())
if
(
detached
())
return
false
;
return
false
;
using
delegate_t
=
dgram_delegate_msg
;
using
delegate_t
=
new_datagram_msg
;
//
dgram_delegate_msg;
using
tmp_t
=
mailbox_element_vals
<
delegate_t
>
;
using
tmp_t
=
mailbox_element_vals
<
delegate_t
>
;
auto
guard
=
parent_
;
auto
guard
=
parent_
;
auto
&
buf
=
rd_buf
();
auto
&
buf
=
rd_buf
();
...
@@ -68,7 +68,7 @@ bool dgram_doorman::delegate_msg(execution_unit* ctx,
...
@@ -68,7 +68,7 @@ bool dgram_doorman::delegate_msg(execution_unit* ctx,
// msg_buf.resize(num_bytes);
// msg_buf.resize(num_bytes);
tmp_t
tmp
{
strong_actor_ptr
{},
message_id
::
make
(),
tmp_t
tmp
{
strong_actor_ptr
{},
message_id
::
make
(),
mailbox_element
::
forwarding_stack
{},
mailbox_element
::
forwarding_stack
{},
delegate_t
{
hdl
(),
endpoint
,
std
::
move
(
buf
)}};
delegate_t
{
endpoint
,
std
::
move
(
buf
)}};
invoke_mailbox_element_impl
(
ctx
,
tmp
);
invoke_mailbox_element_impl
(
ctx
,
tmp
);
return
true
;
return
true
;
}
}
...
...
libcaf_io/src/header.cpp
View file @
bf227239
...
@@ -87,6 +87,22 @@ bool client_handshake_valid(const header& hdr) {
...
@@ -87,6 +87,22 @@ bool client_handshake_valid(const header& hdr) {
&&
zero
(
hdr
.
operation_data
);
&&
zero
(
hdr
.
operation_data
);
}
}
bool
udp_server_handshake_valid
(
const
header
&
hdr
)
{
return
valid
(
hdr
.
source_node
)
&&
valid
(
hdr
.
dest_node
)
&&
hdr
.
source_node
!=
hdr
.
dest_node
&&
zero
(
hdr
.
source_actor
)
&&
zero
(
hdr
.
dest_actor
)
&&
zero
(
hdr
.
operation_data
);
}
bool
udp_client_handshake_valid
(
const
header
&
hdr
)
{
return
valid
(
hdr
.
source_node
)
&&
!
valid
(
hdr
.
dest_node
)
&&
zero
(
hdr
.
dest_actor
)
&&
!
zero
(
hdr
.
operation_data
);
}
bool
dispatch_message_valid
(
const
header
&
hdr
)
{
bool
dispatch_message_valid
(
const
header
&
hdr
)
{
return
valid
(
hdr
.
dest_node
)
return
valid
(
hdr
.
dest_node
)
&&
(
!
zero
(
hdr
.
dest_actor
)
||
hdr
.
has
(
header
::
named_receiver_flag
))
&&
(
!
zero
(
hdr
.
dest_actor
)
||
hdr
.
has
(
header
::
named_receiver_flag
))
...
@@ -141,6 +157,10 @@ bool valid(const header& hdr) {
...
@@ -141,6 +157,10 @@ bool valid(const header& hdr) {
return
kill_proxy_instance_valid
(
hdr
);
return
kill_proxy_instance_valid
(
hdr
);
case
message_type
:
:
heartbeat
:
case
message_type
:
:
heartbeat
:
return
heartbeat_valid
(
hdr
);
return
heartbeat_valid
(
hdr
);
case
message_type
:
:
udp_server_handshake
:
return
udp_server_handshake_valid
(
hdr
);
case
message_type
:
:
udp_client_handshake
:
return
udp_client_handshake_valid
(
hdr
);
}
}
}
}
...
...
libcaf_io/src/instance.cpp
View file @
bf227239
This diff is collapsed.
Click to expand it.
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