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
9763e6fb
Commit
9763e6fb
authored
Aug 16, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cppa:detail::{channel => network_channel} to avoid confusion with cppa::channel
parent
868e3291
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
21 deletions
+21
-21
src/middleman.cpp
src/middleman.cpp
+21
-21
No files found.
src/middleman.cpp
View file @
9763e6fb
...
@@ -155,11 +155,11 @@ class middleman;
...
@@ -155,11 +155,11 @@ class middleman;
typedef
intrusive
::
single_reader_queue
<
middleman_message
>
middleman_queue
;
typedef
intrusive
::
single_reader_queue
<
middleman_message
>
middleman_queue
;
class
channel
:
public
ref_counted
{
class
network_
channel
:
public
ref_counted
{
public:
public:
channel
(
middleman
*
ptr
,
native_socket_type
read_fd
)
network_
channel
(
middleman
*
ptr
,
native_socket_type
read_fd
)
:
m_parent
(
ptr
),
m_read_handle
(
read_fd
)
{
}
:
m_parent
(
ptr
),
m_read_handle
(
read_fd
)
{
}
virtual
bool
continue_reading
()
=
0
;
virtual
bool
continue_reading
()
=
0
;
...
@@ -184,12 +184,12 @@ class channel : public ref_counted {
...
@@ -184,12 +184,12 @@ class channel : public ref_counted {
};
};
typedef
intrusive_ptr
<
channel
>
channel_ptr
;
typedef
intrusive_ptr
<
network_channel
>
network_
channel_ptr
;
typedef
vector
<
channel_ptr
>
channel_ptr_vector
;
typedef
vector
<
network_channel_ptr
>
network_
channel_ptr_vector
;
class
peer_connection
:
public
channel
{
class
peer_connection
:
public
network_
channel
{
typedef
channel
super
;
typedef
network_
channel
super
;
public:
public:
...
@@ -314,7 +314,7 @@ class middleman {
...
@@ -314,7 +314,7 @@ class middleman {
m_new_channels
.
emplace_back
(
new
Connection
(
this
,
forward
<
Args
>
(
args
)...));
m_new_channels
.
emplace_back
(
new
Connection
(
this
,
forward
<
Args
>
(
args
)...));
}
}
inline
void
add_channel_ptr
(
channel_ptr
ptr
)
{
inline
void
add_channel_ptr
(
network_
channel_ptr
ptr
)
{
m_new_channels
.
push_back
(
std
::
move
(
ptr
));
m_new_channels
.
push_back
(
std
::
move
(
ptr
));
}
}
...
@@ -347,9 +347,9 @@ class middleman {
...
@@ -347,9 +347,9 @@ class middleman {
return
nullptr
;
return
nullptr
;
}
}
channel_ptr
acceptor_of
(
const
actor_ptr
&
whom
)
{
network_
channel_ptr
acceptor_of
(
const
actor_ptr
&
whom
)
{
auto
last
=
m_channels
.
end
();
auto
last
=
m_channels
.
end
();
auto
i
=
find_if
(
m_channels
.
begin
(),
last
,
[
=
](
channel_ptr
&
ptr
)
{
auto
i
=
find_if
(
m_channels
.
begin
(),
last
,
[
=
](
network_
channel_ptr
&
ptr
)
{
return
ptr
->
is_acceptor_of
(
whom
);
return
ptr
->
is_acceptor_of
(
whom
);
});
});
return
(
i
!=
last
)
?
*
i
:
nullptr
;
return
(
i
!=
last
)
?
*
i
:
nullptr
;
...
@@ -359,7 +359,7 @@ class middleman {
...
@@ -359,7 +359,7 @@ class middleman {
m_peers_with_unwritten_data
.
insert
(
move
(
ptr
));
m_peers_with_unwritten_data
.
insert
(
move
(
ptr
));
}
}
void
erase
(
channel_ptr
ptr
)
{
void
erase
(
network_
channel_ptr
ptr
)
{
m_erased_channels
.
insert
(
move
(
ptr
));
m_erased_channels
.
insert
(
move
(
ptr
));
}
}
...
@@ -368,11 +368,11 @@ class middleman {
...
@@ -368,11 +368,11 @@ class middleman {
bool
m_done
;
bool
m_done
;
process_information_ptr
m_pself
;
process_information_ptr
m_pself
;
peer_map
m_peers
;
peer_map
m_peers
;
channel_ptr_vector
m_channels
;
network_
channel_ptr_vector
m_channels
;
channel_ptr_vector
m_new_channels
;
network_
channel_ptr_vector
m_new_channels
;
set
<
peer_connection_ptr
>
m_peers_with_unwritten_data
;
set
<
peer_connection_ptr
>
m_peers_with_unwritten_data
;
set
<
channel_ptr
>
m_erased_channels
;
set
<
network_
channel_ptr
>
m_erased_channels
;
};
};
...
@@ -495,9 +495,9 @@ bool peer_connection::continue_reading() {
...
@@ -495,9 +495,9 @@ bool peer_connection::continue_reading() {
}
}
}
}
class
peer_acceptor
:
public
channel
{
class
peer_acceptor
:
public
network_
channel
{
typedef
channel
super
;
typedef
network_
channel
super
;
public:
public:
...
@@ -541,9 +541,9 @@ class peer_acceptor : public channel {
...
@@ -541,9 +541,9 @@ class peer_acceptor : public channel {
};
};
class
middleman_overseer
:
public
channel
{
class
middleman_overseer
:
public
network_
channel
{
typedef
channel
super
;
typedef
network_
channel
super
;
public:
public:
...
@@ -659,7 +659,7 @@ void middleman::operator()(int pipe_fd, middleman_queue& queue) {
...
@@ -659,7 +659,7 @@ void middleman::operator()(int pipe_fd, middleman_queue& queue) {
wrset_ptr
=
&
wrset
;
wrset_ptr
=
&
wrset
;
}
}
CPPA_REQUIRE
(
maxfd
>
0
);
CPPA_REQUIRE
(
maxfd
>
0
);
DEBUG
(
"select()"
);
DEBUG
(
"select()"
);
int
sresult
;
int
sresult
;
do
{
do
{
sresult
=
select
(
maxfd
+
1
,
&
rdset
,
wrset_ptr
,
nullptr
,
nullptr
);
sresult
=
select
(
maxfd
+
1
,
&
rdset
,
wrset_ptr
,
nullptr
,
nullptr
);
...
@@ -668,7 +668,7 @@ DEBUG("select()");
...
@@ -668,7 +668,7 @@ DEBUG("select()");
}
}
}
}
while
(
sresult
==
0
);
while
(
sresult
==
0
);
DEBUG
(
"continue reading ..."
);
DEBUG
(
"continue reading ..."
);
{
// iterate over all channels and remove channels as needed
{
// iterate over all channels and remove channels as needed
for
(
auto
&
channel
:
m_channels
)
{
for
(
auto
&
channel
:
m_channels
)
{
if
(
FD_ISSET
(
channel
->
read_handle
(),
&
rdset
))
{
if
(
FD_ISSET
(
channel
->
read_handle
(),
&
rdset
))
{
...
@@ -686,7 +686,7 @@ DEBUG("continue reading ...");
...
@@ -686,7 +686,7 @@ DEBUG("continue reading ...");
}
}
}
}
if
(
wrset_ptr
)
{
// iterate over peers with unwritten data
if
(
wrset_ptr
)
{
// iterate over peers with unwritten data
DEBUG
(
"continue writing ..."
);
DEBUG
(
"continue writing ..."
);
for
(
auto
&
peer
:
m_peers_with_unwritten_data
)
{
for
(
auto
&
peer
:
m_peers_with_unwritten_data
)
{
if
(
FD_ISSET
(
peer
->
write_handle
(),
&
wrset
))
{
if
(
FD_ISSET
(
peer
->
write_handle
(),
&
wrset
))
{
bool
erase_channel
=
false
;
bool
erase_channel
=
false
;
...
@@ -712,7 +712,7 @@ DEBUG("continue writing ...");
...
@@ -712,7 +712,7 @@ DEBUG("continue writing ...");
if
(
!
m_erased_channels
.
empty
())
{
if
(
!
m_erased_channels
.
empty
())
{
DEBUG
(
"erase channel(s)"
);
DEBUG
(
"erase channel(s)"
);
// erase all marked channels
// erase all marked channels
for
(
channel_ptr
channel
:
m_erased_channels
)
{
for
(
network_
channel_ptr
channel
:
m_erased_channels
)
{
erase_from
(
m_channels
,
channel
);
erase_from
(
m_channels
,
channel
);
erase_from
(
m_peers_with_unwritten_data
,
channel
);
erase_from
(
m_peers_with_unwritten_data
,
channel
);
erase_from_if
(
m_peers
,
[
=
](
const
peer_map
::
value_type
&
kvp
)
{
erase_from_if
(
m_peers
,
[
=
](
const
peer_map
::
value_type
&
kvp
)
{
...
...
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