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
a95ded47
Commit
a95ded47
authored
Jun 23, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert all exceptions in publish to network_error
parent
eb0aae66
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
11 deletions
+24
-11
libcaf_io/src/publish.cpp
libcaf_io/src/publish.cpp
+24
-11
No files found.
libcaf_io/src/publish.cpp
View file @
a95ded47
...
@@ -36,13 +36,13 @@ namespace caf {
...
@@ -36,13 +36,13 @@ namespace caf {
namespace
io
{
namespace
io
{
uint16_t
publish_impl
(
abstract_actor_ptr
whom
,
uint16_t
port
,
uint16_t
publish_impl
(
abstract_actor_ptr
whom
,
uint16_t
port
,
const
char
*
in
,
bool
r
euse
)
{
const
char
*
in
,
bool
r
u
)
{
if
(
whom
==
nullptr
)
{
if
(
whom
==
nullptr
)
{
throw
std
::
invalid_argument
(
"cannot publish an invalid actor"
);
throw
network_error
(
"cannot publish an invalid actor"
);
}
}
CAF_LOGF_TRACE
(
"whom = "
<<
to_string
(
whom
->
address
())
CAF_LOGF_TRACE
(
"whom = "
<<
to_string
(
whom
->
address
())
<<
", "
<<
CAF_ARG
(
port
)
<<
", in = "
<<
(
in
?
in
:
""
)
<<
", "
<<
CAF_ARG
(
port
)
<<
", in = "
<<
(
in
?
in
:
""
)
<<
", "
<<
CAF_ARG
(
r
euse
));
<<
", "
<<
CAF_ARG
(
r
u
));
std
::
string
str
;
std
::
string
str
;
if
(
in
!=
nullptr
)
{
if
(
in
!=
nullptr
)
{
str
=
in
;
str
=
in
;
...
@@ -50,14 +50,27 @@ uint16_t publish_impl(abstract_actor_ptr whom, uint16_t port,
...
@@ -50,14 +50,27 @@ uint16_t publish_impl(abstract_actor_ptr whom, uint16_t port,
auto
mm
=
get_middleman_actor
();
auto
mm
=
get_middleman_actor
();
scoped_actor
self
;
scoped_actor
self
;
uint16_t
result
;
uint16_t
result
;
self
->
sync_send
(
mm
,
put_atom
::
value
,
whom
->
address
(),
port
,
str
,
reuse
).
await
(
std
::
string
error_msg
;
try
{
self
->
sync_send
(
mm
,
put_atom
::
value
,
whom
->
address
(),
port
,
str
,
ru
).
await
(
[
&
](
ok_atom
,
uint16_t
res
)
{
[
&
](
ok_atom
,
uint16_t
res
)
{
result
=
res
;
result
=
res
;
},
},
[
&
](
error_atom
,
std
::
string
&
msg
)
{
[
&
](
error_atom
,
std
::
string
&
msg
)
{
throw
network_error
(
std
::
move
(
msg
));
if
(
!
msg
.
empty
())
error_msg
.
swap
(
msg
);
else
error_msg
=
"an unknown error occurred in the middleman"
;
}
}
);
);
}
catch
(
actor_exited
&
e
)
{
error_msg
=
"scoped actor in caf::publish quit unexpectedly: "
;
error_msg
+=
e
.
what
();
}
if
(
!
error_msg
.
empty
())
{
throw
network_error
(
std
::
move
(
error_msg
));
}
return
result
;
return
result
;
}
}
...
...
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