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
8164dc6a
Commit
8164dc6a
authored
Dec 19, 2016
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extract delivery of pending messages into function
parent
fe9b3ed2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
13 deletions
+26
-13
libcaf_io/caf/io/basp/instance.hpp
libcaf_io/caf/io/basp/instance.hpp
+4
-0
libcaf_io/src/instance.cpp
libcaf_io/src/instance.cpp
+22
-13
No files found.
libcaf_io/caf/io/basp/instance.hpp
View file @
8164dc6a
...
...
@@ -134,6 +134,10 @@ public:
/// Handles a new UDP endpoint msg
bool
handle
(
execution_unit
*
ctx
,
new_endpoint_msg
&
em
,
endpoint_context
&
ep
);
/// Deliver pending incoming messages for an endpoint with
/// application layer ordering
bool
deliver_pending
(
execution_unit
*
ctx
,
endpoint_context
&
ep
);
/// Sends heartbeat messages to all valid nodes those are directly connected.
void
handle_heartbeat
(
execution_unit
*
ctx
);
...
...
libcaf_io/src/instance.cpp
View file @
8164dc6a
...
...
@@ -52,6 +52,24 @@ instance::instance(abstract_broker* parent, callee& lstnr)
CAF_ASSERT
(
this_node_
!=
none
);
}
bool
instance
::
deliver_pending
(
execution_unit
*
ctx
,
endpoint_context
&
ep
)
{
if
(
!
ep
.
requires_ordering
)
return
true
;
std
::
vector
<
char
>*
payload
=
nullptr
;
auto
itr
=
ep
.
pending
.
find
(
ep
.
seq_incoming
);
while
(
itr
!=
ep
.
pending
.
end
())
{
ep
.
hdr
=
std
::
move
(
itr
->
second
.
first
);
payload
=
&
itr
->
second
.
second
;
if
(
!
handle_msg
(
ctx
,
get
<
dgram_scribe_handle
>
(
ep
.
hdl
),
ep
.
hdr
,
payload
,
false
,
ep
,
none
))
return
false
;
ep
.
pending
.
erase
(
itr
);
ep
.
seq_incoming
+=
1
;
itr
=
ep
.
pending
.
find
(
ep
.
seq_incoming
);
}
return
true
;
}
connection_state
instance
::
handle
(
execution_unit
*
ctx
,
new_data_msg
&
dm
,
header
&
hdr
,
bool
is_payload
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
dm
)
<<
CAF_ARG
(
is_payload
));
...
...
@@ -172,18 +190,8 @@ bool instance::handle(execution_unit* ctx, new_datagram_msg& dm,
// TODO: Reliability
if
(
!
handle_msg
(
ctx
,
dm
.
handle
,
ep
.
hdr
,
payload
,
false
,
ep
,
none
))
return
err
();
auto
itr
=
ep
.
pending
.
find
(
ep
.
seq_incoming
);
while
(
itr
!=
ep
.
pending
.
end
())
{
ep
.
hdr
=
std
::
move
(
itr
->
second
.
first
);
pl_buf
=
std
::
move
(
itr
->
second
.
second
);
payload
=
&
pl_buf
;
if
(
!
handle_msg
(
ctx
,
get
<
dgram_scribe_handle
>
(
ep
.
hdl
),
ep
.
hdr
,
payload
,
false
,
ep
,
none
))
err
();
ep
.
pending
.
erase
(
itr
);
ep
.
seq_incoming
+=
1
;
itr
=
ep
.
pending
.
find
(
ep
.
seq_incoming
);
}
if
(
!
deliver_pending
(
ctx
,
ep
))
return
err
();
return
true
;
};
...
...
@@ -237,7 +245,8 @@ bool instance::handle(execution_unit* ctx, new_endpoint_msg& em,
}
if
(
!
handle_msg
(
ctx
,
em
.
handle
,
ep
.
hdr
,
payload
,
false
,
ep
,
em
.
port
))
return
err
();
// TODO: Check for pending messages ...
if
(
!
deliver_pending
(
ctx
,
ep
))
return
err
();
return
true
;
}
...
...
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