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
4a61bd68
Commit
4a61bd68
authored
Sep 18, 2014
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup publish() and remote_actor() impls
parent
c38a1608
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
55 deletions
+11
-55
libcaf_io/caf/io/publish_impl.hpp
libcaf_io/caf/io/publish_impl.hpp
+2
-3
libcaf_io/caf/io/remote_actor.hpp
libcaf_io/caf/io/remote_actor.hpp
+7
-43
libcaf_io/caf/io/remote_actor_impl.hpp
libcaf_io/caf/io/remote_actor_impl.hpp
+2
-9
No files found.
libcaf_io/caf/io/publish_impl.hpp
View file @
4a61bd68
...
@@ -35,15 +35,14 @@ namespace caf {
...
@@ -35,15 +35,14 @@ namespace caf {
namespace
io
{
namespace
io
{
template
<
class
...
Ts
>
template
<
class
...
Ts
>
void
publish_impl
(
abstract_actor_ptr
whom
,
uint16_t
port
,
Ts
&&
...
args
)
{
void
publish_impl
(
abstract_actor_ptr
whom
,
uint16_t
port
,
const
char
*
in
)
{
using
namespace
detail
;
using
namespace
detail
;
auto
mm
=
middleman
::
instance
();
auto
mm
=
middleman
::
instance
();
std
::
promise
<
bool
>
res
;
std
::
promise
<
bool
>
res
;
mm
->
run_later
([
&
]
{
mm
->
run_later
([
&
]
{
auto
bro
=
mm
->
get_named_broker
<
basp_broker
>
(
atom
(
"_BASP"
));
auto
bro
=
mm
->
get_named_broker
<
basp_broker
>
(
atom
(
"_BASP"
));
try
{
try
{
auto
hdl
=
mm
->
backend
().
add_tcp_doorman
(
bro
.
get
(),
port
,
auto
hdl
=
mm
->
backend
().
add_tcp_doorman
(
bro
.
get
(),
port
,
in
);
std
::
forward
<
Ts
>
(
args
)...);
bro
->
announce_published_actor
(
hdl
,
whom
);
bro
->
announce_published_actor
(
hdl
,
whom
);
mm
->
notify
<
hook
::
actor_published
>
(
whom
->
address
(),
port
);
mm
->
notify
<
hook
::
actor_published
>
(
whom
->
address
(),
port
);
res
.
set_value
(
true
);
res
.
set_value
(
true
);
...
...
libcaf_io/caf/io/remote_actor.hpp
View file @
4a61bd68
...
@@ -34,62 +34,26 @@
...
@@ -34,62 +34,26 @@
namespace
caf
{
namespace
caf
{
namespace
io
{
namespace
io
{
/**
* Establish a new connection to a remote actor via `connection`.
* @param connection A connection to another process described by a pair
* of input and output stream.
* @returns An {@link actor_ptr} to the proxy instance
* representing a remote actor.
* @throws std::invalid_argument Thrown when connecting to a typed actor.
*/
template
<
class
Socket
>
inline
actor
remote_actor
(
Socket
fd
)
{
auto
res
=
remote_actor_impl
(
std
::
move
(
fd
),
std
::
set
<
std
::
string
>
{});
return
actor_cast
<
actor
>
(
res
);
}
/**
/**
* Establish a new connection to the actor at `host` on given `port`.
* Establish a new connection to the actor at `host` on given `port`.
* @param host Valid hostname or IP address.
* @param host Valid hostname or IP address.
* @param port TCP port.
* @param port TCP port.
* @returns An {@link actor_ptr} to the proxy instance
* @returns An {@link actor_ptr} to the proxy instance
* representing a remote actor.
*
representing a remote actor.
* @throws std::invalid_argument Thrown when connecting to a typed actor.
* @throws std::invalid_argument Thrown when connecting to a typed actor.
*/
*/
inline
actor
remote_actor
(
const
char
*
host
,
uint16_t
port
)
{
auto
res
=
remote_actor_impl
(
std
::
set
<
std
::
string
>
{},
host
,
port
);
return
actor_cast
<
actor
>
(
res
);
}
/**
* @copydoc remote_actor(const char*, uint16_t)
*/
inline
actor
remote_actor
(
const
std
::
string
&
host
,
uint16_t
port
)
{
inline
actor
remote_actor
(
const
std
::
string
&
host
,
uint16_t
port
)
{
auto
res
=
remote_actor_impl
(
std
::
set
<
std
::
string
>
{},
host
,
port
);
auto
res
=
remote_actor_impl
(
std
::
set
<
std
::
string
>
{},
host
,
port
);
return
actor_cast
<
actor
>
(
res
);
return
actor_cast
<
actor
>
(
res
);
}
}
/**
/**
* @copydoc remote_actor(stream_ptr_pair)
* Establish a new connection to the typed actor at `host` on given `port`.
*/
* @param host Valid hostname or IP address.
template
<
class
List
,
class
Socket
>
* @param port TCP port.
typename
typed_remote_actor_helper
<
List
>::
return_type
* @returns An {@link actor_ptr} to the proxy instance
typed_remote_actor
(
Socket
fd
)
{
* representing a typed remote actor.
typed_remote_actor_helper
<
List
>
f
;
* @throws std::invalid_argument Thrown when connecting to a typed actor.
return
f
(
std
::
move
(
fd
));
}
/**
* @copydoc remote_actor(const char*,uint16_t)
*/
template
<
class
List
>
typename
typed_remote_actor_helper
<
List
>::
return_type
typed_remote_actor
(
const
char
*
host
,
uint16_t
port
)
{
typed_remote_actor_helper
<
List
>
f
;
return
f
(
host
,
port
);
}
/**
* @copydoc remote_actor(const std::string&,uint16_t)
*/
*/
template
<
class
List
>
template
<
class
List
>
typename
typed_remote_actor_helper
<
List
>::
return_type
typename
typed_remote_actor_helper
<
List
>::
return_type
...
...
libcaf_io/caf/io/remote_actor_impl.hpp
View file @
4a61bd68
...
@@ -40,15 +40,9 @@
...
@@ -40,15 +40,9 @@
namespace
caf
{
namespace
caf
{
namespace
io
{
namespace
io
{
constexpr
uint32_t
max_iface_size
=
100
;
constexpr
uint32_t
max_iface_clause_size
=
500
;
using
string_set
=
std
::
set
<
std
::
string
>
;
template
<
class
...
Ts
>
template
<
class
...
Ts
>
abstract_actor_ptr
remote_actor_impl
(
const
std
::
set
<
std
::
string
>&
ifs
,
abstract_actor_ptr
remote_actor_impl
(
const
std
::
set
<
std
::
string
>&
ifs
,
Ts
&&
...
args
)
{
const
std
::
string
&
host
,
uint16_t
port
)
{
auto
mm
=
middleman
::
instance
();
auto
mm
=
middleman
::
instance
();
std
::
string
error_msg
;
std
::
string
error_msg
;
std
::
promise
<
abstract_actor_ptr
>
result_promise
;
std
::
promise
<
abstract_actor_ptr
>
result_promise
;
...
@@ -57,8 +51,7 @@ abstract_actor_ptr remote_actor_impl(const std::set<std::string>& ifs,
...
@@ -57,8 +51,7 @@ abstract_actor_ptr remote_actor_impl(const std::set<std::string>& ifs,
mm
->
run_later
([
&
]
{
mm
->
run_later
([
&
]
{
try
{
try
{
auto
bro
=
mm
->
get_named_broker
<
basp_broker
>
(
atom
(
"_BASP"
));
auto
bro
=
mm
->
get_named_broker
<
basp_broker
>
(
atom
(
"_BASP"
));
auto
hdl
=
mm
->
backend
().
add_tcp_scribe
(
bro
.
get
(),
auto
hdl
=
mm
->
backend
().
add_tcp_scribe
(
bro
.
get
(),
host
,
port
);
std
::
forward
<
Ts
>
(
args
)...);
bro
->
init_client
(
hdl
,
&
hdata
);
bro
->
init_client
(
hdl
,
&
hdata
);
}
}
catch
(...)
{
catch
(...)
{
...
...
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