Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
actor-incubator
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
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-incubator
Commits
64d5b227
Commit
64d5b227
authored
Sep 06, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Catch repeated handshakes
parent
87871105
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
0 deletions
+17
-0
libcaf_net/caf/net/basp/ec.hpp
libcaf_net/caf/net/basp/ec.hpp
+1
-0
libcaf_net/src/application.cpp
libcaf_net/src/application.cpp
+2
-0
libcaf_net/test/application.cpp
libcaf_net/test/application.cpp
+14
-0
No files found.
libcaf_net/caf/net/basp/ec.hpp
View file @
64d5b227
...
...
@@ -36,6 +36,7 @@ enum class ec : uint8_t {
illegal_state
,
invalid_handshake
,
missing_handshake
,
unexpected_handshake
,
version_mismatch
,
unimplemented
,
app_identifiers_mismatch
,
...
...
libcaf_net/src/application.cpp
View file @
64d5b227
...
...
@@ -102,6 +102,8 @@ error application::handle(span<const byte> bytes) {
error
application
::
handle
(
header
hdr
,
span
<
const
byte
>
)
{
switch
(
hdr
.
type
)
{
case
message_type
:
:
handshake
:
return
ec
::
unexpected_handshake
;
case
message_type
:
:
heartbeat
:
return
none
;
default:
...
...
libcaf_net/test/application.cpp
View file @
64d5b227
...
...
@@ -158,6 +158,20 @@ CAF_TEST(app identifier mismatch) {
basp
::
ec
::
app_identifiers_mismatch
);
}
CAF_TEST
(
repeated
handshake
)
{
handle_handshake
();
consume_handshake
();
CAF_CHECK_EQUAL
(
app
.
state
(),
basp
::
connection_state
::
await_header
);
node_id
no_nid
;
std
::
vector
<
std
::
string
>
no_ids
;
auto
payload
=
to_buf
(
no_nid
,
no_ids
);
set_input
(
basp
::
header
{
basp
::
message_type
::
handshake
,
static_cast
<
uint32_t
>
(
payload
.
size
()),
basp
::
version
});
CAF_CHECK_EQUAL
(
app
.
handle_data
(
*
this
,
input
),
none
);
CAF_CHECK_EQUAL
(
app
.
handle_data
(
*
this
,
payload
),
basp
::
ec
::
unexpected_handshake
);
}
CAF_TEST
(
heartbeat
message
)
{
handle_handshake
();
consume_handshake
();
...
...
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