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
660a1af7
Commit
660a1af7
authored
May 14, 2015
by
ufownl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct the mistake of group chat example
parent
f1b66b58
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
examples/remote_actors/group_chat.cpp
examples/remote_actors/group_chat.cpp
+6
-6
No files found.
examples/remote_actors/group_chat.cpp
View file @
660a1af7
...
...
@@ -32,8 +32,6 @@ istream& operator>>(istream& is, line& l) {
return
is
;
}
namespace
{
string
s_last_line
;
}
void
client
(
event_based_actor
*
self
,
const
string
&
name
)
{
self
->
become
(
[
=
](
broadcast_atom
,
const
string
&
message
)
{
...
...
@@ -44,7 +42,7 @@ void client(event_based_actor* self, const string& name) {
[
=
](
join_atom
,
const
group
&
what
)
{
for
(
auto
g
:
self
->
joined_groups
())
{
cout
<<
"*** leave "
<<
to_string
(
g
)
<<
endl
;
self
->
send
(
self
,
g
,
name
+
" has left the chatroom"
);
self
->
send
(
g
,
name
+
" has left the chatroom"
);
self
->
leave
(
g
);
}
cout
<<
"*** join "
<<
to_string
(
what
)
<<
endl
;
...
...
@@ -53,7 +51,9 @@ void client(event_based_actor* self, const string& name) {
},
[
=
](
const
string
&
txt
)
{
// don't print own messages
if
(
self
->
current_sender
()
!=
self
)
cout
<<
txt
<<
endl
;
if
(
self
->
current_sender
()
!=
self
)
{
cout
<<
txt
<<
endl
;
}
},
[
=
](
const
group_down_msg
&
g
)
{
cout
<<
"*** chatroom offline: "
<<
to_string
(
g
.
source
)
<<
endl
;
...
...
@@ -148,8 +148,8 @@ int main(int argc, char** argv) {
" /help print this text
\n
"
<<
flush
;
},
others
>>
[
&
]
{
if
(
!
s_last_line
.
empty
())
{
anon_send
(
client_actor
,
broadcast_atom
::
value
,
s_last_line
);
if
(
!
i
->
str
.
empty
())
{
anon_send
(
client_actor
,
broadcast_atom
::
value
,
i
->
str
);
}
}
});
...
...
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