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
857f4a0f
Commit
857f4a0f
authored
Sep 17, 2019
by
Jakob Otto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Include review feedback
parent
ec2fe898
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
16 deletions
+11
-16
libcaf_net/caf/net/fwd.hpp
libcaf_net/caf/net/fwd.hpp
+1
-1
libcaf_net/caf/net/transport_worker_dispatcher.hpp
libcaf_net/caf/net/transport_worker_dispatcher.hpp
+7
-9
libcaf_net/test/transport_worker_dispatcher.cpp
libcaf_net/test/transport_worker_dispatcher.cpp
+3
-6
No files found.
libcaf_net/caf/net/fwd.hpp
View file @
857f4a0f
...
@@ -29,7 +29,7 @@ class multiplexer;
...
@@ -29,7 +29,7 @@ class multiplexer;
class
socket_manager
;
class
socket_manager
;
template
<
class
Application
,
class
IdType
=
unit_t
>
template
<
class
Application
,
class
IdType
=
unit_t
>
class
transport_worker
;
class
transport_worker
;
template
<
class
Application
,
class
IdType
>
template
<
class
Application
,
class
IdType
=
unit_t
>
class
transport_worker_dispatcher
;
class
transport_worker_dispatcher
;
struct
network_socket
;
struct
network_socket
;
...
...
libcaf_net/caf/net/transport_worker_dispatcher.hpp
View file @
857f4a0f
...
@@ -58,12 +58,8 @@ public:
...
@@ -58,12 +58,8 @@ public:
// -- member functions -------------------------------------------------------
// -- member functions -------------------------------------------------------
template
<
class
Parent
>
template
<
class
Parent
>
error
init
(
Parent
&
parent
)
{
error
init
(
Parent
&
)
{
for
(
const
auto
&
p
:
workers_by_id_
)
{
CAF_ASSERT
(
workers_by_id_
.
empty
());
auto
worker
=
p
.
second
;
if
(
auto
err
=
worker
->
init
(
parent
))
return
err
;
}
return
none
;
return
none
;
}
}
...
@@ -72,7 +68,7 @@ public:
...
@@ -72,7 +68,7 @@ public:
auto
it
=
workers_by_id_
.
find
(
id
);
auto
it
=
workers_by_id_
.
find
(
id
);
if
(
it
==
workers_by_id_
.
end
())
{
if
(
it
==
workers_by_id_
.
end
())
{
// TODO: where to get node_id from here?
// TODO: where to get node_id from here?
add_new_worker
(
node_id
{},
id
);
add_new_worker
(
parent
,
node_id
{},
id
);
it
=
workers_by_id_
.
find
(
id
);
it
=
workers_by_id_
.
find
(
id
);
}
}
auto
worker
=
it
->
second
;
auto
worker
=
it
->
second
;
...
@@ -89,7 +85,7 @@ public:
...
@@ -89,7 +85,7 @@ public:
auto
it
=
workers_by_node_
.
find
(
nid
);
auto
it
=
workers_by_node_
.
find
(
nid
);
if
(
it
==
workers_by_node_
.
end
())
{
if
(
it
==
workers_by_node_
.
end
())
{
// TODO: where to get id_type from here?
// TODO: where to get id_type from here?
add_new_worker
(
nid
,
id_type
{});
add_new_worker
(
parent
,
nid
,
id_type
{});
it
=
workers_by_node_
.
find
(
nid
);
it
=
workers_by_node_
.
find
(
nid
);
}
}
auto
worker
=
it
->
second
;
auto
worker
=
it
->
second
;
...
@@ -132,9 +128,11 @@ public:
...
@@ -132,9 +128,11 @@ public:
}
}
}
}
void
add_new_worker
(
node_id
node
,
id_type
id
)
{
template
<
class
Parent
>
void
add_new_worker
(
Parent
&
parent
,
node_id
node
,
id_type
id
)
{
auto
application
=
factory_
.
make
();
auto
application
=
factory_
.
make
();
auto
worker
=
std
::
make_shared
<
worker_type
>
(
std
::
move
(
application
),
id
);
auto
worker
=
std
::
make_shared
<
worker_type
>
(
std
::
move
(
application
),
id
);
worker
->
init
(
parent
);
workers_by_id_
.
emplace
(
std
::
move
(
id
),
worker
);
workers_by_id_
.
emplace
(
std
::
move
(
id
),
worker
);
workers_by_node_
.
emplace
(
std
::
move
(
node
),
std
::
move
(
worker
));
workers_by_node_
.
emplace
(
std
::
move
(
node
),
std
::
move
(
worker
));
}
}
...
...
libcaf_net/test/transport_worker_dispatcher.cpp
View file @
857f4a0f
...
@@ -196,8 +196,9 @@ struct fixture : host_fixture {
...
@@ -196,8 +196,9 @@ struct fixture : host_fixture {
void
add_new_workers
()
{
void
add_new_workers
()
{
for
(
auto
&
data
:
test_data
)
{
for
(
auto
&
data
:
test_data
)
{
dispatcher
.
add_new_worker
(
data
.
nid
,
data
.
ep
);
dispatcher
.
add_new_worker
(
d
ummy
,
d
ata
.
nid
,
data
.
ep
);
}
}
buf
->
clear
();
}
}
void
test_write_message
(
testdata
&
testcase
)
{
void
test_write_message
(
testdata
&
testcase
)
{
...
@@ -249,13 +250,9 @@ struct fixture : host_fixture {
...
@@ -249,13 +250,9 @@ struct fixture : host_fixture {
CAF_TEST_FIXTURE_SCOPE
(
transport_worker_dispatcher_test
,
fixture
)
CAF_TEST_FIXTURE_SCOPE
(
transport_worker_dispatcher_test
,
fixture
)
CAF_TEST
(
init
)
{
CAF_TEST
(
init
)
{
dispatcher_type
dispatcher
{
dummy_application_factory
{
buf
}};
if
(
auto
err
=
dispatcher
.
init
(
dummy
))
if
(
auto
err
=
dispatcher
.
init
(
dummy
))
CAF_FAIL
(
"init failed with error: "
<<
err
);
CAF_FAIL
(
"init failed with error: "
<<
err
);
CAF_CHECK_EQUAL
(
buf
->
size
(),
4u
);
CAF_CHECK
(
contains
(
byte
(
0
)));
CAF_CHECK
(
contains
(
byte
(
1
)));
CAF_CHECK
(
contains
(
byte
(
2
)));
CAF_CHECK
(
contains
(
byte
(
3
)));
}
}
CAF_TEST
(
handle_data
)
{
CAF_TEST
(
handle_data
)
{
...
...
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