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
211c30f4
Commit
211c30f4
authored
Nov 12, 2016
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworking datagram management types
parent
9971d016
Changes
30
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
662 additions
and
1807 deletions
+662
-1807
libcaf_io/CMakeLists.txt
libcaf_io/CMakeLists.txt
+4
-7
libcaf_io/caf/io/abstract_broker.hpp
libcaf_io/caf/io/abstract_broker.hpp
+49
-113
libcaf_io/caf/io/basp_broker.hpp
libcaf_io/caf/io/basp_broker.hpp
+1
-4
libcaf_io/caf/io/broker.hpp
libcaf_io/caf/io/broker.hpp
+2
-3
libcaf_io/caf/io/broker_servant.hpp
libcaf_io/caf/io/broker_servant.hpp
+5
-9
libcaf_io/caf/io/datagram_sink.hpp
libcaf_io/caf/io/datagram_sink.hpp
+0
-65
libcaf_io/caf/io/dgram_doorman.hpp
libcaf_io/caf/io/dgram_doorman.hpp
+15
-14
libcaf_io/caf/io/dgram_doorman_handle.hpp
libcaf_io/caf/io/dgram_doorman_handle.hpp
+18
-18
libcaf_io/caf/io/dgram_scribe.hpp
libcaf_io/caf/io/dgram_scribe.hpp
+22
-23
libcaf_io/caf/io/dgram_scribe_handle.hpp
libcaf_io/caf/io/dgram_scribe_handle.hpp
+18
-18
libcaf_io/caf/io/endpoint_handle.hpp
libcaf_io/caf/io/endpoint_handle.hpp
+0
-84
libcaf_io/caf/io/fwd.hpp
libcaf_io/caf/io/fwd.hpp
+2
-3
libcaf_io/caf/io/network/default_multiplexer.hpp
libcaf_io/caf/io/network/default_multiplexer.hpp
+92
-160
libcaf_io/caf/io/network/dgram_acceptor_manager.hpp
libcaf_io/caf/io/network/dgram_acceptor_manager.hpp
+7
-6
libcaf_io/caf/io/network/dgram_communicator_manager.hpp
libcaf_io/caf/io/network/dgram_communicator_manager.hpp
+9
-9
libcaf_io/caf/io/network/endpoint_manager.hpp
libcaf_io/caf/io/network/endpoint_manager.hpp
+0
-50
libcaf_io/caf/io/network/multiplexer.hpp
libcaf_io/caf/io/network/multiplexer.hpp
+22
-50
libcaf_io/caf/io/network/test_multiplexer.hpp
libcaf_io/caf/io/network/test_multiplexer.hpp
+44
-110
libcaf_io/caf/io/system_messages.hpp
libcaf_io/caf/io/system_messages.hpp
+41
-80
libcaf_io/src/abstract_broker.cpp
libcaf_io/src/abstract_broker.cpp
+41
-97
libcaf_io/src/basp_broker.cpp
libcaf_io/src/basp_broker.cpp
+7
-21
libcaf_io/src/datagram_source.cpp
libcaf_io/src/datagram_source.cpp
+0
-75
libcaf_io/src/datagram_source_manager.cpp
libcaf_io/src/datagram_source_manager.cpp
+0
-37
libcaf_io/src/default_multiplexer.cpp
libcaf_io/src/default_multiplexer.cpp
+156
-491
libcaf_io/src/dgram_acceptor_manager.cpp
libcaf_io/src/dgram_acceptor_manager.cpp
+3
-3
libcaf_io/src/dgram_communicator_manager.cpp
libcaf_io/src/dgram_communicator_manager.cpp
+3
-3
libcaf_io/src/dgram_doorman.cpp
libcaf_io/src/dgram_doorman.cpp
+14
-21
libcaf_io/src/dgram_scribe.cpp
libcaf_io/src/dgram_scribe.cpp
+10
-10
libcaf_io/src/test_multiplexer.cpp
libcaf_io/src/test_multiplexer.cpp
+75
-221
libcaf_io/test/datagram.cpp
libcaf_io/test/datagram.cpp
+2
-2
No files found.
libcaf_io/CMakeLists.txt
View file @
211c30f4
...
...
@@ -23,12 +23,10 @@ set (LIBCAF_IO_SRCS
src/acceptor_manager.cpp
src/multiplexer.cpp
src/uri.cpp
src/endpoint.cpp
src/endpoint_manager.cpp
src/datagram_sink_manager.cpp
src/datagram_source_manager.cpp
src/datagram_sink.cpp
src/datagram_source.cpp
src/dgram_scribe.cpp
src/dgram_doorman.cpp
src/dgram_acceptor_manager.cpp
src/dgram_communicator_manager.cpp
# BASP files
src/header.cpp
src/message_type.cpp
...
...
@@ -72,4 +70,3 @@ include_directories(. ${INCLUDE_DIRS})
if
(
NOT WIN32
)
install
(
DIRECTORY caf/ DESTINATION include/caf FILES_MATCHING PATTERN
"*.hpp"
)
endif
()
libcaf_io/caf/io/abstract_broker.hpp
View file @
211c30f4
This diff is collapsed.
Click to expand it.
libcaf_io/caf/io/basp_broker.hpp
View file @
211c30f4
...
...
@@ -115,7 +115,7 @@ struct basp_broker_state : proxy_registry::backend, basp::instance::callee {
// our current processed BSAP header
basp
::
header
hdr
;
// local source
endpoint
_handle
hdl
;
dgram_scribe
_handle
hdl
;
// network-agnositc node identifier
node_id
id
;
// ports
...
...
@@ -127,7 +127,6 @@ struct basp_broker_state : proxy_registry::backend, basp::instance::callee {
};
void
set_context
(
connection_handle
hdl
);
void
set_context
(
endpoint_handle
hdl
);
// pointer to ourselves
broker
*
self
;
...
...
@@ -137,11 +136,9 @@ struct basp_broker_state : proxy_registry::backend, basp::instance::callee {
// keeps context information for all open connections
std
::
unordered_map
<
connection_handle
,
connection_context
>
tcp_ctx
;
std
::
unordered_map
<
endpoint_handle
,
endpoint_context
>
udp_ctx
;
// points to the current context for callbacks such as `make_proxy`
connection_context
*
this_context
=
nullptr
;
endpoint_context
*
udp_context
=
nullptr
;
// stores handles to spawn servers for other nodes; these servers
// are spawned whenever the broker learns a new node ID and try to
...
...
libcaf_io/caf/io/broker.hpp
View file @
211c30f4
...
...
@@ -30,10 +30,9 @@
#include "caf/io/scribe.hpp"
#include "caf/io/doorman.hpp"
#include "caf/io/endpoint.hpp"
#include "caf/io/datagram_sink.hpp"
#include "caf/io/dgram_doorman.hpp"
#include "caf/io/abstract_broker.hpp"
#include "caf/io/d
atagram_sourc
e.hpp"
#include "caf/io/d
gram_scrib
e.hpp"
#include "caf/mixin/sender.hpp"
#include "caf/mixin/requester.hpp"
...
...
libcaf_io/caf/io/broker_servant.hpp
View file @
211c30f4
...
...
@@ -29,8 +29,8 @@
namespace
caf
{
namespace
io
{
/// Base class for `scribe` and `doorman` as well as `d
atagram_source
`
/// and `d
atagram_sink
`.
/// Base class for `scribe` and `doorman` as well as `d
gram_doorman
`
/// and `d
gram_scribe
`.
/// @ingroup Broker
template
<
class
Base
,
class
Handle
,
class
SysMsgType
>
class
broker_servant
:
public
Base
{
...
...
@@ -106,13 +106,9 @@ protected:
std
::
is_same
<
Handle
,
accept_handle
>::
value
,
acceptor_passivated_msg
,
typename
std
::
conditional
<
std
::
is_same
<
Handle
,
endpoint_handle
>::
value
,
endpoint_passivated_msg
,
typename
std
::
conditional
<
std
::
is_same
<
Handle
,
datagram_sink_handle
>::
value
,
datagram_sink_passivated_msg
,
datagram_source_passivated_msg
>::
type
std
::
is_same
<
Handle
,
dgram_scribe_handle
>::
value
,
dgram_scribe_passivated_msg
,
dgram_doorman_passivated_msg
>::
type
>::
type
>::
type
;
...
...
libcaf_io/caf/io/datagram_sink.hpp
deleted
100644 → 0
View file @
9971d016
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2016 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_IO_DATAGRAM_SINK_HPP
#define CAF_IO_DATAGRAM_SINK_HPP
#include <vector>
#include "caf/message.hpp"
#include "caf/io/broker_servant.hpp"
#include "caf/io/system_messages.hpp"
#include "caf/io/datagram_sink_handle.hpp"
#include "caf/io/network/datagram_sink_manager.hpp"
namespace
caf
{
namespace
io
{
using
datagram_sink_base
=
broker_servant
<
network
::
datagram_sink_manager
,
datagram_sink_handle
,
datagram_sink_msg
>
;
/// Manages writing to a datagram sink.
/// @ingroup Broker
class
datagram_sink
:
public
datagram_sink_base
{
public:
datagram_sink
(
abstract_broker
*
parent
,
datagram_sink_handle
hdl
);
~
datagram_sink
();
/// Enables or disables write notifications.
virtual
void
ack_writes
(
bool
enable
)
=
0
;
/// Returns the current write buffer.
virtual
std
::
vector
<
char
>&
wr_buf
()
=
0
;
void
datagram_sent
(
execution_unit
*
ctx
,
size_t
num_bytes
)
override
;
void
io_failure
(
execution_unit
*
ctx
,
network
::
operation
op
)
override
;
protected:
message
detach_message
()
override
;
};
}
// namespace io
}
// namespace caf
#endif // CAF_IO_DATAGRAM_SINK_HPP
libcaf_io/caf/io/d
atagram_source
.hpp
→
libcaf_io/caf/io/d
gram_doorman
.hpp
View file @
211c30f4
...
...
@@ -17,8 +17,8 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_IO_D
ATAGRAM_SOURCE
_HPP
#define CAF_IO_D
ATAGRAM_SOURCE
_HPP
#ifndef CAF_IO_D
GRAM_DOORMAN
_HPP
#define CAF_IO_D
GRAM_DOORMAN
_HPP
#include <vector>
...
...
@@ -26,23 +26,23 @@
#include "caf/io/broker_servant.hpp"
#include "caf/io/system_messages.hpp"
#include "caf/io/d
atagram_source
_handle.hpp"
#include "caf/io/network/d
atagram_source
_manager.hpp"
#include "caf/io/d
gram_doorman
_handle.hpp"
#include "caf/io/network/d
gram_communicator
_manager.hpp"
namespace
caf
{
namespace
io
{
using
d
atagram_source_base
=
broker_servant
<
network
::
datagram_source
_manager
,
datagram_source
_handle
,
new_datagram
_msg
>
;
using
d
gram_doorman_base
=
broker_servant
<
network
::
dgram_acceptor
_manager
,
dgram_doorman
_handle
,
new_endpoint
_msg
>
;
/// Manages reading from a datagram source
/// @ingroup Broker
class
d
atagram_source
:
public
datagram_source
_base
{
class
d
gram_doorman
:
public
dgram_doorman
_base
{
public:
d
atagram_source
(
abstract_broker
*
parent
,
datagram_source
_handle
hdl
);
d
gram_doorman
(
abstract_broker
*
parent
,
dgram_doorman
_handle
hdl
);
~
d
atagram_source
();
~
d
gram_doorman
();
/// Configure buffer size for next accepted datagram.
virtual
void
configure_datagram_size
(
size_t
buf_size
)
=
0
;
...
...
@@ -50,10 +50,12 @@ public:
/// Returns the current input buffer.
virtual
std
::
vector
<
char
>&
rd_buf
()
=
0
;
bool
consume
(
execution_unit
*
ctx
,
const
void
*
buf
,
size_t
besize
)
override
;
void
io_failure
(
execution_unit
*
ctx
,
network
::
operation
op
)
override
;
using
dgram_doorman_base
::
new_endpoint
;
bool
new_endpoint
(
execution_unit
*
ctx
,
const
void
*
,
size_t
num_bytes
);
// needs to be launched explicitly
virtual
void
launch
()
=
0
;
...
...
@@ -64,5 +66,4 @@ protected:
}
// namespace io
}
// namespace caf
#endif // CAF_IO_DATAGRAM_SOURCE_HPP
#endif // CAF_IO_DGRAM_DOORMAN_HPP
libcaf_io/caf/io/d
atagram_source
_handle.hpp
→
libcaf_io/caf/io/d
gram_doorman
_handle.hpp
View file @
211c30f4
...
...
@@ -17,8 +17,8 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_IO_D
ATAGRAM_SOURCE
_HANDLE_HPP
#define CAF_IO_D
ATAGRAM_SOURCE
_HANDLE_HPP
#ifndef CAF_IO_D
GRAM_DOORMAN
_HANDLE_HPP
#define CAF_IO_D
GRAM_DOORMAN
_HANDLE_HPP
#include <functional>
...
...
@@ -31,40 +31,40 @@
namespace
caf
{
namespace
io
{
struct
invalid_d
atagram_source
_handle_t
{
constexpr
invalid_d
atagram_source
_handle_t
()
{
struct
invalid_d
gram_doorman
_handle_t
{
constexpr
invalid_d
gram_doorman
_handle_t
()
{
// nop
}
};
constexpr
invalid_d
atagram_source_handle_t
invalid_datagram_source
_handle
=
invalid_d
atagram_source
_handle_t
{};
constexpr
invalid_d
gram_doorman_handle_t
invalid_dgram_doorman
_handle
=
invalid_d
gram_doorman
_handle_t
{};
/// Generic type for identifying a datagram source.
class
d
atagram_source_handle
:
public
handle
<
datagram_source
_handle
,
invalid_d
atagram_source
_handle_t
>
{
class
d
gram_doorman_handle
:
public
handle
<
dgram_doorman
_handle
,
invalid_d
gram_doorman
_handle_t
>
{
public:
friend
class
handle
<
d
atagram_source_handle
,
invalid_datagram_source
_handle_t
>
;
friend
class
handle
<
d
gram_doorman_handle
,
invalid_dgram_doorman
_handle_t
>
;
using
super
=
handle
<
d
atagram_source_handle
,
invalid_datagram_source
_handle_t
>
;
using
super
=
handle
<
d
gram_doorman_handle
,
invalid_dgram_doorman
_handle_t
>
;
constexpr
d
atagram_source
_handle
()
{
constexpr
d
gram_doorman
_handle
()
{
// nop
}
constexpr
d
atagram_source_handle
(
const
invalid_datagram_source
_handle_t
&
)
{
constexpr
d
gram_doorman_handle
(
const
invalid_dgram_doorman
_handle_t
&
)
{
// nop
}
template
<
class
Inspector
>
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
d
atagram_source
_handle
&
x
)
{
return
f
(
meta
::
type_name
(
"d
atagram_source
_handle"
),
x
.
id_
);
d
gram_doorman
_handle
&
x
)
{
return
f
(
meta
::
type_name
(
"d
gram_doorman
_handle"
),
x
.
id_
);
}
private:
inline
d
atagram_source
_handle
(
int64_t
handle_id
)
:
super
(
handle_id
)
{
inline
d
gram_doorman
_handle
(
int64_t
handle_id
)
:
super
(
handle_id
)
{
// nop
}
};
...
...
@@ -75,12 +75,12 @@ private:
namespace
std
{
template
<
>
struct
hash
<
caf
::
io
::
d
atagram_source
_handle
>
{
size_t
operator
()(
const
caf
::
io
::
d
atagram_source
_handle
&
hdl
)
const
{
struct
hash
<
caf
::
io
::
d
gram_doorman
_handle
>
{
size_t
operator
()(
const
caf
::
io
::
d
gram_doorman
_handle
&
hdl
)
const
{
hash
<
int64_t
>
f
;
return
f
(
hdl
.
id
());
}
};
}
// namespace std
#endif // CAF_IO_D
ATAGRAM_SOURCE
_HANDLE_HPP
#endif // CAF_IO_D
GRAM_DOORMAN
_HANDLE_HPP
libcaf_io/caf/io/
endpoint
.hpp
→
libcaf_io/caf/io/
dgram_scribe
.hpp
View file @
211c30f4
...
...
@@ -17,61 +17,60 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_IO_
ENDPOINT
_HPP
#define CAF_IO_
ENDPOINT
_HPP
#ifndef CAF_IO_
DGRAM_SCRIBE
_HPP
#define CAF_IO_
DGRAM_SCRIBE
_HPP
#include <vector>
#include "caf/message.hpp"
#include "caf/io/broker_servant.hpp"
#include "caf/io/endpoint_handle.hpp"
#include "caf/io/system_messages.hpp"
#include "caf/io/network/endpoint_manager.hpp"
#include "caf/io/dgram_scribe_handle.hpp"
#include "caf/io/network/dgram_acceptor_manager.hpp"
namespace
caf
{
namespace
io
{
using
endpoint_base
=
broker_servant
<
network
::
endpoint_manager
,
endpoint_handle
,
datagram_msg
>
;
using
dgram_scribe_base
=
broker_servant
<
network
::
dgram_communicator_manager
,
dgram_scribe_handle
,
new_datagram_msg
>
;
/// Manages writing
and reading on a datagram endpoint
.
/// Manages writing
to a datagram sink
.
/// @ingroup Broker
class
endpoint
:
public
endpoint
_base
{
class
dgram_scribe
:
public
dgram_scribe
_base
{
public:
endpoint
(
abstract_broker
*
parent
,
endpoint
_handle
hdl
);
dgram_scribe
(
abstract_broker
*
parent
,
dgram_scribe
_handle
hdl
);
~
endpoint
();
/// Enables or disables write notifications.
virtual
void
ack_writes
(
bool
enable
)
=
0
;
~
dgram_scribe
();
/// Configure buffer size for next accepted datagram.
/// Implicitly starts the read loop on first call.
virtual
void
configure_datagram_size
(
size_t
buf_size
)
=
0
;
/// Returns the current write buffer.
/// Enables or disables write notifications.
virtual
void
ack_writes
(
bool
enable
)
=
0
;
/// Returns the current output buffer.
virtual
std
::
vector
<
char
>&
wr_buf
()
=
0
;
/// Returns the current input buffer.
virtual
std
::
vector
<
char
>&
rd_buf
()
=
0
;
bool
consume
(
execution_unit
*
ctx
,
const
void
*
buf
,
size_t
besize
)
override
;
v
oid
datagram_sent
(
execution_unit
*
ctx
,
size_t
num_bytes
)
override
;
/// Flushes the output buffer, i.e., sends the
/// content of the buffer via the network.
v
irtual
void
flush
()
=
0
;
void
io_failure
(
execution_unit
*
ctx
,
network
::
operation
op
)
override
;
// needs to be launched explicitly, TODO: Does it?
// Can't configure_datagram_size do that?
v
irtual
void
launch
()
=
0
;
bool
consume
(
execution_unit
*
,
const
void
*
,
size_t
)
override
;
v
oid
datagram_sent
(
execution_unit
*
,
size_t
)
override
;
protected:
message
detach_message
()
override
;
};
}
// namespace io
}
// namespace caf
#endif // CAF_IO_
ENDPOINT
_HPP
#endif // CAF_IO_
DGRAM_SCRIBE
_HPP
libcaf_io/caf/io/d
atagram_sink
_handle.hpp
→
libcaf_io/caf/io/d
gram_scribe
_handle.hpp
View file @
211c30f4
...
...
@@ -17,8 +17,8 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_IO_D
ATAGRAM_SINK
_HANDLE_HPP
#define CAF_IO_D
ATAGRAM_SINK
_HANDLE_HPP
#ifndef CAF_IO_D
GRAM_SCRIBE
_HANDLE_HPP
#define CAF_IO_D
GRAM_SCRIBE
_HANDLE_HPP
#include <functional>
...
...
@@ -31,36 +31,36 @@
namespace
caf
{
namespace
io
{
struct
invalid_d
atagram_sink
_handle_t
{
constexpr
invalid_d
atagram_sink
_handle_t
()
{
struct
invalid_d
gram_scribe
_handle_t
{
constexpr
invalid_d
gram_scribe
_handle_t
()
{
// nop
}
};
constexpr
invalid_d
atagram_sink_handle_t
invalid_datagram_sink
_handle
=
invalid_d
atagram_sink
_handle_t
{};
constexpr
invalid_d
gram_scribe_handle_t
invalid_dgram_scribe
_handle
=
invalid_d
gram_scribe
_handle_t
{};
/// Generic type for identifying datagram sink.
class
d
atagram_sink_handle
:
public
handle
<
datagram_sink
_handle
,
invalid_d
atagram_sink
_handle_t
>
{
class
d
gram_scribe_handle
:
public
handle
<
dgram_scribe
_handle
,
invalid_d
gram_scribe
_handle_t
>
{
public:
friend
class
handle
<
d
atagram_sink_handle
,
invalid_datagram_sink
_handle_t
>
;
friend
class
handle
<
d
gram_scribe_handle
,
invalid_dgram_scribe
_handle_t
>
;
using
super
=
handle
<
d
atagram_sink_handle
,
invalid_datagram_sink
_handle_t
>
;
using
super
=
handle
<
d
gram_scribe_handle
,
invalid_dgram_scribe
_handle_t
>
;
d
atagram_sink
_handle
()
:
port_
{
0
}
{
d
gram_scribe
_handle
()
:
port_
{
0
}
{
// nop
}
d
atagram_sink_handle
(
const
invalid_datagram_sink
_handle_t
&
)
:
port_
{
0
}
{
d
gram_scribe_handle
(
const
invalid_dgram_scribe
_handle_t
&
)
:
port_
{
0
}
{
// nop
}
template
<
class
Inspector
>
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
d
atagram_sink
_handle
&
x
)
{
return
f
(
meta
::
type_name
(
"d
atagram_sink
_handle"
),
x
.
id_
);
d
gram_scribe
_handle
&
x
)
{
return
f
(
meta
::
type_name
(
"d
gram_scribe
_handle"
),
x
.
id_
);
}
const
std
::
string
&
host
()
const
{
...
...
@@ -80,7 +80,7 @@ public:
}
private:
inline
d
atagram_sink
_handle
(
int64_t
handle_id
)
:
super
(
handle_id
)
{
inline
d
gram_scribe
_handle
(
int64_t
handle_id
)
:
super
(
handle_id
)
{
// nop
}
std
::
string
host_
;
...
...
@@ -93,12 +93,12 @@ private:
namespace
std
{
template
<
>
struct
hash
<
caf
::
io
::
d
atagram_sink
_handle
>
{
size_t
operator
()(
const
caf
::
io
::
d
atagram_sink
_handle
&
hdl
)
const
{
struct
hash
<
caf
::
io
::
d
gram_scribe
_handle
>
{
size_t
operator
()(
const
caf
::
io
::
d
gram_scribe
_handle
&
hdl
)
const
{
hash
<
int64_t
>
f
;
return
f
(
hdl
.
id
());
}
};
}
// namespace std
#endif // CAF_IO_D
ATAGRAM_SINK
_HANDLE_HPP
#endif // CAF_IO_D
GRAM_SCRIBE
_HANDLE_HPP
libcaf_io/caf/io/endpoint_handle.hpp
deleted
100644 → 0
View file @
9971d016
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2016 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_IO_ENDPOINT_HANDLE_HPP
#define CAF_IO_ENDPOINT_HANDLE_HPP
#include "caf/error.hpp"
#include "caf/io/handle.hpp"
#include "caf/meta/type_name.hpp"
namespace
caf
{
namespace
io
{
struct
invalid_endpoint_handle_t
{
constexpr
invalid_endpoint_handle_t
()
{
// nop
}
};
constexpr
invalid_endpoint_handle_t
invalid_endpoint_handle
=
invalid_endpoint_handle_t
{};
/// Generic handle type for managing local and remote datagram endpoints.
class
endpoint_handle
:
public
handle
<
endpoint_handle
,
invalid_endpoint_handle_t
>
{
public:
friend
class
handle
<
endpoint_handle
,
invalid_endpoint_handle_t
>
;
using
super
=
handle
<
endpoint_handle
,
invalid_endpoint_handle_t
>
;
constexpr
endpoint_handle
()
{
// nop
}
constexpr
endpoint_handle
(
const
invalid_endpoint_handle_t
&
)
{
// nop
}
template
<
class
Inspector
>
friend
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
endpoint_handle
&
x
)
{
return
f
(
meta
::
type_name
(
"endpoint_handle"
),
x
.
id_
);
}
private:
inline
endpoint_handle
(
int64_t
handle_id
)
:
super
(
handle_id
)
{
// nop
}
};
}
// namespace io
}
// namespace caf
namespace
std
{
template
<
>
struct
hash
<
caf
::
io
::
endpoint_handle
>
{
size_t
operator
()(
const
caf
::
io
::
endpoint_handle
&
hdl
)
const
{
hash
<
int64_t
>
f
;
return
f
(
hdl
.
id
());
}
};
}
// namespace std
#endif // CAF_IO_ENDPOINT_HANDLE_HPP
libcaf_io/caf/io/fwd.hpp
View file @
211c30f4
...
...
@@ -26,13 +26,12 @@ namespace io {
class
scribe
;
class
broker
;
class
doorman
;
class
endpoint
;
class
middleman
;
class
basp_broker
;
class
d
atagram_sink
;
class
d
gram_doorman
;
class
receive_policy
;
class
abstract_broker
;
class
d
atagram_sourc
e
;
class
d
gram_scrib
e
;
template
<
class
...
Sigs
>
class
typed_broker
;
...
...
libcaf_io/caf/io/network/default_multiplexer.hpp
View file @
211c30f4
This diff is collapsed.
Click to expand it.
libcaf_io/caf/io/network/d
atagram_source
_manager.hpp
→
libcaf_io/caf/io/network/d
gram_acceptor
_manager.hpp
View file @
211c30f4
...
...
@@ -17,8 +17,8 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_IO_NETWORK_D
ATAGRAM_SOURCE
_MANGER_HPP
#define CAF_IO_NETWORK_D
ATAGRAM_SOURCE
_MANGER_HPP
#ifndef CAF_IO_NETWORK_D
GRAM_ACCEPTOR
_MANGER_HPP
#define CAF_IO_NETWORK_D
GRAM_ACCEPTOR
_MANGER_HPP
#include "caf/io/network/manager.hpp"
...
...
@@ -28,17 +28,18 @@ namespace network {
/// A datagram source manager provides callbacks for incoming
/// datagrams as well as for error handling.
class
d
atagram_source
_manager
:
public
manager
{
class
d
gram_acceptor
_manager
:
public
manager
{
public:
d
atagram_source
_manager
(
abstract_broker
*
ptr
);
d
gram_acceptor
_manager
(
abstract_broker
*
ptr
);
~
d
atagram_source_manager
();
~
d
gram_acceptor_manager
();
virtual
bool
new_endpoint
()
=
0
;
};
}
// namespace network
}
// namespace io
}
// namespace caf
#endif // CAF_IO_NETWORK_D
ATAGRAM_SOURCE
_MANGER_HPP
#endif // CAF_IO_NETWORK_D
GRAM_ACCEPTOR
_MANGER_HPP
libcaf_io/caf/io/network/d
atagram_sink
_manager.hpp
→
libcaf_io/caf/io/network/d
gram_communicator
_manager.hpp
View file @
211c30f4
...
...
@@ -17,8 +17,8 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_IO_NETWORK_D
ATAGRAM_SINK
_MANGER_HPP
#define CAF_IO_NETWORK_D
ATAGRAM_SINK
_MANGER_HPP
#ifndef CAF_IO_NETWORK_D
GRAM_COMMUNICATOR
_MANGER_HPP
#define CAF_IO_NETWORK_D
GRAM_COMMUNICATOR
_MANGER_HPP
#include "caf/io/network/manager.hpp"
...
...
@@ -28,22 +28,22 @@ namespace network {
/// A datagram manager provides callbacks for outgoing
/// datagrams as well as for error handling.
class
d
atagram_sink
_manager
:
public
manager
{
class
d
gram_communicator
_manager
:
public
manager
{
public:
d
atagram_sink
_manager
(
abstract_broker
*
ptr
);
d
gram_communicator
_manager
(
abstract_broker
*
ptr
);
~
d
atagram_sink
_manager
();
~
d
gram_communicator
_manager
();
/// Called by the underlying I/O device whenever it received data.
/// @returns `true` if the manager accepts further reads, otherwise `false`.
virtual
bool
consume
(
execution_unit
*
ctx
,
const
void
*
buf
,
size_t
besize
)
=
0
;
virtual
bool
consume
(
execution_unit
*
,
const
void
*
,
size_t
)
=
0
;
/// Called by the underlying I/O device whenever it sent
a datagram
.
virtual
void
datagram_sent
(
execution_unit
*
ctx
,
size_t
num_bytes
)
=
0
;
/// Called by the underlying I/O device whenever it sent
data
.
virtual
void
datagram_sent
(
execution_unit
*
,
size_t
)
=
0
;
};
}
// namespace network
}
// namespace io
}
// namespace caf
#endif // CAF_IO_NETWORK_D
ATAGRAM_SINK
_MANGER_HPP
#endif // CAF_IO_NETWORK_D
GRAM_COMMUNICATOR
_MANGER_HPP
libcaf_io/caf/io/network/endpoint_manager.hpp
deleted
100644 → 0
View file @
9971d016
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2016 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_IO_NETWORK_ENDPOINT_MANAGER_HPP
#define CAF_IO_NETWORK_ENDPOINT_MANAGER_HPP
#include "caf/io/network/manager.hpp"
namespace
caf
{
namespace
io
{
namespace
network
{
/// An endpoint manager configures datagram endpoints and provides callbacks
/// for incoming data as well as for error handling.
class
endpoint_manager
:
public
manager
{
public:
endpoint_manager
(
abstract_broker
*
ptr
);
~
endpoint_manager
();
/// Called by the underlying I/O device whenever it received data.
/// @returns `true` if the manager accepts further reads, otherwise `false`.
virtual
bool
consume
(
execution_unit
*
ctx
,
const
void
*
buf
,
size_t
bsize
)
=
0
;
/// Called by the underlying I/O device whenever it sent a datagram.
virtual
void
datagram_sent
(
execution_unit
*
ctx
,
size_t
num_bytes
)
=
0
;
};
}
// namespace network
}
// namespace io
}
// namespace caf
#endif // CAF_IO_NETWORK_ENDPOINT_MANAGER_HPP
libcaf_io/caf/io/network/multiplexer.hpp
View file @
211c30f4
...
...
@@ -32,10 +32,9 @@
#include "caf/io/fwd.hpp"
#include "caf/io/accept_handle.hpp"
#include "caf/io/endpoint_handle.hpp"
#include "caf/io/connection_handle.hpp"
#include "caf/io/d
atagram_sink
_handle.hpp"
#include "caf/io/d
atagram_source
_handle.hpp"
#include "caf/io/d
gram_scribe
_handle.hpp"
#include "caf/io/d
gram_doorman
_handle.hpp"
#include "caf/io/network/protocol.hpp"
#include "caf/io/network/native_socket.hpp"
...
...
@@ -104,77 +103,50 @@ public:
/// Tries to create a datagram sink to sent messages to `host` on given
/// `port` and returns an unbound datagram sink handle on success.
/// @threadsafe
virtual
expected
<
d
atagram_sink
_handle
>
new_d
atagram_sink
(
const
std
::
string
&
host
,
uint16_t
port
)
=
0
;
virtual
expected
<
d
gram_scribe
_handle
>
new_d
gram_scribe
(
const
std
::
string
&
host
,
uint16_t
port
)
=
0
;
/// Assigns an unbound datagram sink identified by `hdl` to `ptr`.
/// @warning Do not call from outside the multiplexer's event loop.
virtual
expected
<
void
>
assign_datagram_sink
(
abstract_broker
*
ptr
,
datagram_sink_handle
hdl
)
=
0
;
virtual
expected
<
void
>
assign_dgram_scribe
(
abstract_broker
*
ptr
,
dgram_scribe_handle
hdl
)
=
0
;
/// Creates a new datagram sink from a native socket handle.
/// @warning Do not call from outside the multiplexer's event loop.
virtual
d
atagram_sink_handle
add_datagram_sink
(
abstract_broker
*
ptr
,
native_socket
fd
)
=
0
;
virtual
d
gram_scribe_handle
add_dgram_scribe
(
abstract_broker
*
ptr
,
native_socket
fd
)
=
0
;
/// Tries to create a datagram sink to sent messages to `host` on `port`
/// and returns a new datagram sink managing the endpoint on success.
/// @warning Do not call from outside the multiplexer's event loop.
virtual
expected
<
d
atagram_sink
_handle
>
add_d
atagram_sink
(
abstract_broker
*
,
const
std
::
string
&
host
,
uint16_t
port
)
=
0
;
virtual
expected
<
d
gram_scribe
_handle
>
add_d
gram_scribe
(
abstract_broker
*
,
const
std
::
string
&
host
,
uint16_t
port
)
=
0
;
/// Tries to create an unbound datagram source bound to `port`, optionally
/// accepting only messages from IP address `in`.
/// @warning Do not call from outside the multiplexer's event loop.
virtual
expected
<
std
::
pair
<
d
atagram_source
_handle
,
uint16_t
>>
new_d
atagram_source
(
uint16_t
port
,
const
char
*
in
=
nullptr
,
bool
reuse_addr
=
false
)
=
0
;
virtual
expected
<
std
::
pair
<
d
gram_doorman
_handle
,
uint16_t
>>
new_d
gram_doorman
(
uint16_t
port
,
const
char
*
in
=
nullptr
,
bool
reuse_addr
=
false
)
=
0
;
/// Assigns an unbound datagram source identified by `hdl` to `ptr`.
/// @warning Do not call from outside the multiplexer's event loop.
virtual
expected
<
void
>
assign_d
atagram_source
(
abstract_broker
*
ptr
,
datagram_source
_handle
)
=
0
;
virtual
expected
<
void
>
assign_d
gram_doorman
(
abstract_broker
*
ptr
,
dgram_doorman
_handle
)
=
0
;
/// Creates a new datagram source from a native socket handle.
/// @warning Do not call from outside the multiplexer's event loop.
virtual
d
atagram_source_handle
add_datagram_source
(
abstract_broker
*
ptr
,
native_socket
fd
)
=
0
;
virtual
d
gram_doorman_handle
add_dgram_doorman
(
abstract_broker
*
ptr
,
native_socket
fd
)
=
0
;
/// Tries to create a new datagram source on port `p`, optionally
/// accepting only messages from IP address `in`.
/// @warning Do not call from outside the multiplexer's event loop.
virtual
expected
<
std
::
pair
<
datagram_source_handle
,
uint16_t
>>
add_datagram_source
(
abstract_broker
*
ptr
,
uint16_t
port
,
const
char
*
in
=
nullptr
,
bool
reuse_addr
=
false
)
=
0
;
/// TODO
virtual
expected
<
endpoint_handle
>
new_remote_endpoint
(
const
std
::
string
&
host
,
uint16_t
port
)
=
0
;
/// TODO
virtual
expected
<
std
::
pair
<
endpoint_handle
,
uint16_t
>>
new_local_endpoint
(
uint16_t
port
=
0
,
const
char
*
in
=
nullptr
,
bool
reuse_addr
=
false
)
=
0
;
/// TODO
virtual
expected
<
void
>
assign_endpoint
(
abstract_broker
*
ptr
,
endpoint_handle
hdl
)
=
0
;
/// TODO
virtual
expected
<
endpoint_handle
>
add_remote_endpoint
(
abstract_broker
*
ptr
,
const
std
::
string
&
host
,
uint16_t
port
)
=
0
;
/// TODO
expected
<
std
::
pair
<
endpoint_handle
,
uint16_t
>>
virtual
add_local_endpoint
(
abstract_broker
*
ptr
,
uint16_t
port
=
0
,
const
char
*
in
=
nullptr
,
bool
reuse_addr
=
false
)
=
0
;
/// TODO
virtual
endpoint_handle
add_endpoint
(
abstract_broker
*
ptr
,
network
::
native_socket
fd
)
=
0
;
virtual
expected
<
std
::
pair
<
dgram_doorman_handle
,
uint16_t
>>
add_dgram_doorman
(
abstract_broker
*
ptr
,
uint16_t
port
,
const
char
*
in
=
nullptr
,
bool
reuse_addr
=
false
)
=
0
;
/// Simple wrapper for runnables
class
runnable
:
public
resumable
,
public
ref_counted
{
...
...
libcaf_io/caf/io/network/test_multiplexer.hpp
View file @
211c30f4
This diff is collapsed.
Click to expand it.
libcaf_io/caf/io/system_messages.hpp
View file @
211c30f4
...
...
@@ -29,10 +29,9 @@
#include "caf/io/handle.hpp"
#include "caf/io/accept_handle.hpp"
#include "caf/io/endpoint_handle.hpp"
#include "caf/io/connection_handle.hpp"
#include "caf/io/d
atagram_sink
_handle.hpp"
#include "caf/io/d
atagram_source
_handle.hpp"
#include "caf/io/d
gram_scribe
_handle.hpp"
#include "caf/io/d
gram_doorman
_handle.hpp"
namespace
caf
{
namespace
io
{
...
...
@@ -130,111 +129,61 @@ inspect(Inspector& f, acceptor_passivated_msg& x) {
}
/// Signalizes that a {@link broker} datagram sink was closed.
struct
d
atagram_sink
_closed_msg
{
d
atagram_sink
_handle
handle
;
struct
d
gram_scribe
_closed_msg
{
d
gram_scribe
_handle
handle
;
};
/// @relates d
atagram_sink
_closed_msg
/// @relates d
gram_scribe
_closed_msg
template
<
class
Inspector
>
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
d
atagram_sink
_closed_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"d
atagram_sink
_closed_msg"
),
x
.
handle
);
inspect
(
Inspector
&
f
,
d
gram_scribe
_closed_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"d
gram_scribe
_closed_msg"
),
x
.
handle
);
}
/// Signalizes that a {@link broker} datagram source was closed.
struct
d
atagram_source
_closed_msg
{
d
atagram_source
_handle
handle
;
struct
d
gram_doorman
_closed_msg
{
d
gram_doorman
_handle
handle
;
};
/// @relates d
atagram_source
_closed_msg
/// @relates d
gram_doorman
_closed_msg
template
<
class
Inspector
>
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
d
atagram_source
_closed_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"d
atagram_source
_closed_msg"
),
x
.
handle
);
inspect
(
Inspector
&
f
,
d
gram_doorman
_closed_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"d
gram_doorman
_closed_msg"
),
x
.
handle
);
}
/// Signalizes newly arrived datagram for a {@link broker}.
struct
new_
datagram
_msg
{
struct
new_
endpoint
_msg
{
/// Handle to the related datagram endpoint.
d
atagram_source
_handle
handle
;
d
gram_doorman
_handle
handle
;
/// Buffer containing the received data.
std
::
vector
<
char
>
buf
;
};
/// @relates new_
datagram
_msg
/// @relates new_
endpoint
_msg
template
<
class
Inspector
>
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
new_
datagram
_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"new_
datagram
_msg"
),
x
.
handle
,
x
.
buf
);
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
new_
endpoint
_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"new_
endpoint
_msg"
),
x
.
handle
,
x
.
buf
);
}
/// Signalizes that a datagram with a certain size has been sent.
struct
datagram_sink
_msg
{
struct
new_datagram
_msg
{
// Handle to the endpoint used.
d
atagram_sink
_handle
handle
;
d
gram_scribe
_handle
handle
;
// number of bytes written.
uint64_t
written
;
};
/// @relates datagram_sink_msg
template
<
class
Inspector
>
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
datagram_sink_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"datagram_sink_msg"
),
x
.
handle
,
x
.
written
);
}
/// Signalizes that a datagram sink has entered passive mode.
struct
datagram_sink_passivated_msg
{
datagram_sink_handle
handle
;
};
/// @relates datagram_sink_passivated_msg
template
<
class
Inspector
>
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
datagram_sink_passivated_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"datagram_sink_passivated_msg"
),
x
.
handle
);
}
/// Signalizes that a datagram source has entered passive mode.
struct
datagram_source_passivated_msg
{
datagram_source_handle
handle
;
};
/// @relates datagram_source_passivated_msg
template
<
class
Inspector
>
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
datagram_source_passivated_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"datagram_source_passivated_msg"
),
x
.
handle
);
}
/// Signalizes that a {@link broker} datagram endpoint was closed.
struct
endpoint_closed_msg
{
endpoint_handle
handle
;
};
/// @relates endpoint_closed_msg
template
<
class
Inspector
>
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
endpoint_closed_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"endpoint_closed_msg"
),
x
.
handle
);
}
// Signalizes newly arrived datagram for a {@link broker}.
struct
datagram_msg
{
/// Handle to the related datagram endpoint.
endpoint_handle
handle
;
/// Buffer containing the received data.
std
::
vector
<
char
>
buf
;
};
/// @relates datagram_msg
/// @relates new_datagram_msg
template
<
class
Inspector
>
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
datagram_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"
datagram_msg"
),
x
.
handle
,
x
.
buf
);
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
new_
datagram_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"
new_datagram_msg"
),
x
.
handle
,
x
.
written
);
}
/// Signalizes that a datagram with a certain size has been sent.
struct
datagram_sent_msg
{
// Handle to the endpoint used.
endpoint
_handle
handle
;
dgram_scribe
_handle
handle
;
// number of bytes written.
uint64_t
written
;
};
...
...
@@ -245,16 +194,28 @@ typename Inspector::result_type inspect(Inspector& f, datagram_sent_msg& x) {
return
f
(
meta
::
type_name
(
"datagram_sent_msg"
),
x
.
handle
,
x
.
written
);
}
/// Signalizes that a endpoint has entered passive mode.
struct
endpoint_passivated_msg
{
endpoint_handle
handle
;
/// Signalizes that a datagram sink has entered passive mode.
struct
dgram_scribe_passivated_msg
{
dgram_scribe_handle
handle
;
};
/// @relates dgram_scribe_passivated_msg
template
<
class
Inspector
>
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
dgram_scribe_passivated_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"dgram_scribe_passivated_msg"
),
x
.
handle
);
}
/// Signalizes that a datagram source has entered passive mode.
struct
dgram_doorman_passivated_msg
{
dgram_doorman_handle
handle
;
};
/// @relates
endpoint
_passivated_msg
/// @relates
dgram_doorman
_passivated_msg
template
<
class
Inspector
>
typename
Inspector
::
result_type
inspect
(
Inspector
&
f
,
endpoint
_passivated_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"
endpoint
_passivated_msg"
),
x
.
handle
);
inspect
(
Inspector
&
f
,
dgram_doorman
_passivated_msg
&
x
)
{
return
f
(
meta
::
type_name
(
"
dgram_doorman
_passivated_msg"
),
x
.
handle
);
}
}
// namespace io
...
...
libcaf_io/src/abstract_broker.cpp
View file @
211c30f4
...
...
@@ -110,14 +110,14 @@ void abstract_broker::flush(connection_handle hdl) {
x
->
flush
();
}
void
abstract_broker
::
ack_writes
(
d
atagram_sink
_handle
hdl
,
bool
enable
)
{
void
abstract_broker
::
ack_writes
(
d
gram_scribe
_handle
hdl
,
bool
enable
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
)
<<
CAF_ARG
(
enable
));
auto
x
=
by_id
(
hdl
);
if
(
x
)
x
->
ack_writes
(
enable
);
}
void
abstract_broker
::
configure_datagram_size
(
d
atagram_source
_handle
hdl
,
void
abstract_broker
::
configure_datagram_size
(
d
gram_doorman
_handle
hdl
,
size_t
buf_size
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
)
<<
CAF_ARG
(
buf_size
));
auto
x
=
by_id
(
hdl
);
...
...
@@ -125,17 +125,17 @@ void abstract_broker::configure_datagram_size(datagram_source_handle hdl,
x
->
configure_datagram_size
(
buf_size
);
}
std
::
vector
<
char
>&
abstract_broker
::
wr_buf
(
d
atagram_sink
_handle
hdl
)
{
std
::
vector
<
char
>&
abstract_broker
::
wr_buf
(
d
gram_scribe
_handle
hdl
)
{
auto
x
=
by_id
(
hdl
);
if
(
!
x
)
{
CAF_LOG_ERROR
(
"tried to access wr_buf() of an unknown"
"d
atagram_sink
_handle"
);
"d
gram_scribe
_handle"
);
return
dummy_wr_buf_
;
}
return
x
->
wr_buf
();
}
void
abstract_broker
::
write
(
d
atagram_sink
_handle
hdl
,
size_t
bs
,
void
abstract_broker
::
write
(
d
gram_scribe
_handle
hdl
,
size_t
bs
,
const
void
*
buf
)
{
auto
&
out
=
wr_buf
(
hdl
);
auto
first
=
reinterpret_cast
<
const
char
*>
(
buf
);
...
...
@@ -143,37 +143,6 @@ void abstract_broker::write(datagram_sink_handle hdl, size_t bs,
out
.
insert
(
out
.
end
(),
first
,
last
);
}
void
abstract_broker
::
ack_writes
(
endpoint_handle
hdl
,
bool
enable
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
)
<<
CAF_ARG
(
enable
));
auto
x
=
by_id
(
hdl
);
if
(
x
)
x
->
ack_writes
(
enable
);
}
void
abstract_broker
::
configure_datagram_size
(
endpoint_handle
hdl
,
size_t
buf_size
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
)
<<
CAF_ARG
(
buf_size
));
auto
x
=
by_id
(
hdl
);
if
(
x
)
x
->
configure_datagram_size
(
buf_size
);
}
std
::
vector
<
char
>&
abstract_broker
::
wr_buf
(
endpoint_handle
hdl
)
{
auto
x
=
by_id
(
hdl
);
if
(
!
x
)
{
CAF_LOG_ERROR
(
"tried to access wr_buf() of an unknown endpoint_handle"
);
return
dummy_wr_buf_
;
}
return
x
->
wr_buf
();
}
void
abstract_broker
::
write
(
endpoint_handle
hdl
,
size_t
bs
,
const
void
*
buf
)
{
auto
&
out
=
wr_buf
(
hdl
);
auto
first
=
reinterpret_cast
<
const
char
*>
(
buf
);
auto
last
=
first
+
bs
;
out
.
insert
(
out
.
end
(),
first
,
last
);
}
std
::
vector
<
connection_handle
>
abstract_broker
::
connections
()
const
{
std
::
vector
<
connection_handle
>
result
;
result
.
reserve
(
scribes_
.
size
());
...
...
@@ -228,80 +197,51 @@ abstract_broker::add_tcp_doorman(network::native_socket fd) {
return
backend
().
add_tcp_doorman
(
this
,
fd
);
}
void
abstract_broker
::
add_d
atagram_sink
(
const
intrusive_ptr
<
datagram_sink
>&
ptr
)
{
d
atagram_sink
s_
.
emplace
(
ptr
->
hdl
(),
ptr
);
void
abstract_broker
::
add_d
gram_scribe
(
const
intrusive_ptr
<
dgram_scribe
>&
ptr
)
{
d
gram_scribe
s_
.
emplace
(
ptr
->
hdl
(),
ptr
);
}
expected
<
d
atagram_sink
_handle
>
abstract_broker
::
add_d
atagram_sink
(
const
std
::
string
&
hostname
,
uint16_t
port
)
{
expected
<
d
gram_scribe
_handle
>
abstract_broker
::
add_d
gram_scribe
(
const
std
::
string
&
hostname
,
uint16_t
port
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hostname
)
<<
CAF_ARG
(
port
));
return
backend
().
add_d
atagram_sink
(
this
,
hostname
,
port
);
return
backend
().
add_d
gram_scribe
(
this
,
hostname
,
port
);
}
expected
<
void
>
abstract_broker
::
assign_d
atagram_sink
(
datagram_sink
_handle
hdl
)
{
expected
<
void
>
abstract_broker
::
assign_d
gram_scribe
(
dgram_scribe
_handle
hdl
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
));
return
backend
().
assign_d
atagram_sink
(
this
,
hdl
);
return
backend
().
assign_d
gram_scribe
(
this
,
hdl
);
}
expected
<
d
atagram_sink
_handle
>
abstract_broker
::
add_d
atagram_sink
(
network
::
native_socket
fd
)
{
expected
<
d
gram_scribe
_handle
>
abstract_broker
::
add_d
gram_scribe
(
network
::
native_socket
fd
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
fd
));
return
backend
().
add_d
atagram_sink
(
this
,
fd
);
return
backend
().
add_d
gram_scribe
(
this
,
fd
);
}
void
abstract_broker
::
add_d
atagram_source
(
const
intrusive_ptr
<
datagram_source
>&
ptr
)
{
d
atagram_source
s_
.
emplace
(
ptr
->
hdl
(),
ptr
);
abstract_broker
::
add_d
gram_doorman
(
const
intrusive_ptr
<
dgram_doorman
>&
ptr
)
{
d
gram_doorman
s_
.
emplace
(
ptr
->
hdl
(),
ptr
);
ptr
->
launch
();
// TODO: some launching of things?
}
expected
<
std
::
pair
<
d
atagram_source
_handle
,
uint16_t
>>
abstract_broker
::
add_d
atagram_source
(
uint16_t
port
,
const
char
*
in
,
expected
<
std
::
pair
<
d
gram_doorman
_handle
,
uint16_t
>>
abstract_broker
::
add_d
gram_doorman
(
uint16_t
port
,
const
char
*
in
,
bool
reuse_addr
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
port
)
<<
CAF_ARG
(
in
)
<<
CAF_ARG
(
reuse_addr
));
return
backend
().
add_d
atagram_source
(
this
,
port
,
in
,
reuse_addr
);
return
backend
().
add_d
gram_doorman
(
this
,
port
,
in
,
reuse_addr
);
}
expected
<
void
>
abstract_broker
::
assign_datagram_source
(
datagram_source_handle
hdl
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
));
return
backend
().
assign_datagram_source
(
this
,
hdl
);
}
expected
<
datagram_source_handle
>
abstract_broker
::
add_datagram_source
(
network
::
native_socket
fd
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
fd
));
return
backend
().
add_datagram_source
(
this
,
fd
);
}
void
abstract_broker
::
add_endpoint
(
const
intrusive_ptr
<
endpoint
>&
ptr
)
{
endpoints_
.
emplace
(
ptr
->
hdl
(),
ptr
);
ptr
->
launch
();
// TODO: Is this required?
}
expected
<
void
>
abstract_broker
::
assign_endpoint
(
endpoint_handle
hdl
)
{
abstract_broker
::
assign_dgram_doorman
(
dgram_doorman_handle
hdl
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
));
return
backend
().
assign_endpoint
(
this
,
hdl
);
}
expected
<
endpoint_handle
>
abstract_broker
::
add_remote_endpoint
(
const
std
::
string
&
host
,
uint16_t
port
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
host
)
<<
CAF_ARG
(
port
));
return
backend
().
add_remote_endpoint
(
this
,
host
,
port
);
return
backend
().
assign_dgram_doorman
(
this
,
hdl
);
}
expected
<
std
::
pair
<
endpoint_handle
,
uint16_t
>>
abstract_broker
::
add_local_endpoint
(
uint16_t
port
,
const
char
*
in
,
bool
reuse_addr
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
port
)
<<
CAF_ARG
(
in
)
<<
CAF_ARG
(
reuse_addr
));
return
backend
().
add_local_endpoint
(
this
,
port
,
in
,
reuse_addr
);
}
expected
<
endpoint_handle
>
abstract_broker
::
add_endpoint
(
network
::
native_socket
fd
)
{
expected
<
dgram_doorman_handle
>
abstract_broker
::
add_dgram_doorman
(
network
::
native_socket
fd
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
fd
));
return
backend
().
add_
endpoint
(
this
,
fd
);
return
backend
().
add_
dgram_doorman
(
this
,
fd
);
}
std
::
string
abstract_broker
::
remote_addr
(
connection_handle
hdl
)
{
...
...
@@ -324,19 +264,19 @@ uint16_t abstract_broker::local_port(accept_handle hdl) {
return
i
!=
doormen_
.
end
()
?
i
->
second
->
port
()
:
0
;
}
std
::
string
abstract_broker
::
remote_addr
(
d
atagram_sink
_handle
hdl
)
{
auto
i
=
d
atagram_sink
s_
.
find
(
hdl
);
return
i
!=
d
atagram_sink
s_
.
end
()
?
i
->
second
->
addr
()
:
std
::
string
{};
std
::
string
abstract_broker
::
remote_addr
(
d
gram_scribe
_handle
hdl
)
{
auto
i
=
d
gram_scribe
s_
.
find
(
hdl
);
return
i
!=
d
gram_scribe
s_
.
end
()
?
i
->
second
->
addr
()
:
std
::
string
{};
}
uint16_t
abstract_broker
::
remote_port
(
d
atagram_sink
_handle
hdl
)
{
auto
i
=
d
atagram_sink
s_
.
find
(
hdl
);
return
i
!=
d
atagram_sink
s_
.
end
()
?
i
->
second
->
port
()
:
0
;
uint16_t
abstract_broker
::
remote_port
(
d
gram_scribe
_handle
hdl
)
{
auto
i
=
d
gram_scribe
s_
.
find
(
hdl
);
return
i
!=
d
gram_scribe
s_
.
end
()
?
i
->
second
->
port
()
:
0
;
}
uint16_t
abstract_broker
::
local_port
(
d
atagram_source
_handle
hdl
)
{
auto
i
=
d
atagram_source
s_
.
find
(
hdl
);
return
i
!=
d
atagram_source
s_
.
end
()
?
i
->
second
->
port
()
:
0
;
uint16_t
abstract_broker
::
local_port
(
d
gram_doorman
_handle
hdl
)
{
auto
i
=
d
gram_doorman
s_
.
find
(
hdl
);
return
i
!=
d
gram_doorman
s_
.
end
()
?
i
->
second
->
port
()
:
0
;
}
accept_handle
abstract_broker
::
hdl_by_port
(
uint16_t
port
)
{
...
...
@@ -356,9 +296,13 @@ void abstract_broker::close_all() {
// stop_reading will remove the scribe from scribes_
scribes_
.
begin
()
->
second
->
stop_reading
();
}
while
(
!
endpoints_
.
empty
())
{
// stop_reading will remove the enpoint from endpoints_
endpoints_
.
begin
()
->
second
->
stop_reading
();
while
(
!
dgram_doormans_
.
empty
())
{
// stop_reading will remove the scribe from dgram_doormans_
dgram_doormans_
.
begin
()
->
second
->
stop_reading
();
}
while
(
!
dgram_scribes_
.
empty
())
{
// stop_reading will remove the scribe from dgram_scribes_
dgram_scribes_
.
begin
()
->
second
->
stop_reading
();
}
}
...
...
libcaf_io/src/basp_broker.cpp
View file @
211c30f4
...
...
@@ -465,21 +465,6 @@ void basp_broker_state::set_context(connection_handle hdl) {
this_context
=
&
i
->
second
;
}
void
basp_broker_state
::
set_context
(
endpoint_handle
hdl
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
));
auto
i
=
udp_ctx
.
find
(
hdl
);
if
(
i
==
udp_ctx
.
end
())
{
CAF_LOG_INFO
(
"create new BASP context:"
<<
CAF_ARG
(
hdl
));
i
=
udp_ctx
.
emplace
(
hdl
,
endpoint_context
{
basp
::
header
{
basp
::
message_type
::
client_handshake
,
0
,
0
,
0
,
none
,
none
,
invalid_actor_id
,
invalid_actor_id
},
hdl
,
none
,
0
,
0
,
none
}).
first
;
}
udp_context
=
&
i
->
second
;
}
/******************************************************************************
* basp_broker *
******************************************************************************/
...
...
@@ -537,10 +522,11 @@ behavior basp_broker::make_behavior() {
}
},
// received from underlying broker implementation
[
=
](
datagram_msg
&
msg
)
{
[
=
](
new_
datagram_msg
&
msg
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
msg
.
handle
));
CAF_LOG_DEBUG
(
"Received new_datagram_msg: "
<<
CAF_ARG
(
msg
));
state
.
set_context
(
msg
.
handle
);
static_cast
<
void
>
(
msg
);
// state.set_context(msg.handle);
// auto& ctx = *state.udp_context;
//auto next = state.instance.handle(context(), msg, ctx.hdr, ...);
// TODO: implement this
...
...
@@ -645,14 +631,14 @@ behavior basp_broker::make_behavior() {
<<
CAF_ARG
(
whom
));
}
},
[
=
](
publish_atom
,
d
atagram_source
_handle
hdl
,
uint16_t
port
,
[
=
](
publish_atom
,
d
gram_doorman
_handle
hdl
,
uint16_t
port
,
const
strong_actor_ptr
&
whom
,
std
::
set
<
std
::
string
>&
sigs
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
.
id
())
<<
CAF_ARG
(
whom
)
<<
CAF_ARG
(
port
));
if
(
hdl
.
invalid
())
{
CAF_LOG_WARNING
(
"invalid handle"
);
return
;
}
auto
res
=
assign_d
atagram_source
(
hdl
);
auto
res
=
assign_d
gram_doorman
(
hdl
);
if
(
res
)
{
if
(
whom
)
system
().
registry
().
put
(
whom
->
id
(),
whom
);
...
...
@@ -680,13 +666,13 @@ behavior basp_broker::make_behavior() {
rp
.
deliver
(
std
::
move
(
res
.
error
()));
}
},
[
=
](
connect_atom
,
endpoint
_handle
hdl
,
uint16_t
port
)
{
[
=
](
connect_atom
,
dgram_scribe
_handle
hdl
,
uint16_t
port
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
.
id
()));
static_cast
<
void
>
(
hdl
);
static_cast
<
void
>
(
port
);
/*
auto rp = make_response_promise();
auto res = assign_d
atagram_sink
(hdl);
auto res = assign_d
gram_scribe
(hdl);
if (res) {
auto& ctx = state.udp_ctx[hdl];
ctx.sink = hdl;
...
...
libcaf_io/src/datagram_source.cpp
deleted
100644 → 0
View file @
9971d016
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2016 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/io/datagram_source.hpp"
#include "caf/logger.hpp"
namespace
caf
{
namespace
io
{
datagram_source
::
datagram_source
(
abstract_broker
*
parent
,
datagram_source_handle
hdl
)
:
datagram_source_base
(
parent
,
hdl
)
{
// nop
}
datagram_source
::~
datagram_source
()
{
CAF_LOG_TRACE
(
""
);
}
message
datagram_source
::
detach_message
()
{
return
make_message
(
datagram_source_closed_msg
{
hdl
()});
}
bool
datagram_source
::
consume
(
execution_unit
*
ctx
,
const
void
*
,
size_t
num_bytes
)
{
CAF_ASSERT
(
ctx
!=
nullptr
);
CAF_LOG_TRACE
(
CAF_ARG
(
num_bytes
));
if
(
detached
())
// we are already disconnected from the broker while the multiplexer
// did not yet remove the socket, this can happen if an I/O event causes
// the broker to call close_all() while the pollset contained
// further activities for the broker
return
false
;
// keep a strong reference to our parent until we leave scope
// to avoid UB when becoming detached during invocation
auto
guard
=
parent_
;
auto
&
buf
=
rd_buf
();
CAF_ASSERT
(
buf
.
size
()
>=
num_bytes
);
// make sure size is correct, swap into message, and then call client
buf
.
resize
(
num_bytes
);
auto
&
msg_buf
=
msg
().
buf
;
msg_buf
.
swap
(
buf
);
auto
result
=
invoke_mailbox_element
(
ctx
);
// swap buffer back to stream and implicitly flush wr_buf()
msg_buf
.
swap
(
buf
);
// flush(); // <-- TODO: here from scribe, not sure why?
return
result
;
}
void
datagram_source
::
io_failure
(
execution_unit
*
ctx
,
network
::
operation
op
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
())
<<
CAF_ARG
(
op
));
// keep compiler happy when compiling w/o logging
static_cast
<
void
>
(
op
);
detach
(
ctx
,
true
);
}
}
// namespace io
}
// namespace caf
libcaf_io/src/datagram_source_manager.cpp
deleted
100644 → 0
View file @
9971d016
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2016 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/io/network/datagram_source_manager.hpp"
namespace
caf
{
namespace
io
{
namespace
network
{
datagram_source_manager
::
datagram_source_manager
(
abstract_broker
*
ptr
)
:
manager
(
ptr
)
{
// nop
}
datagram_source_manager
::~
datagram_source_manager
()
{
// nop
}
}
// namespace network
}
// namespace io
}
// namespace caf
libcaf_io/src/default_multiplexer.cpp
View file @
211c30f4
This diff is collapsed.
Click to expand it.
libcaf_io/src/d
atagram_sink
_manager.cpp
→
libcaf_io/src/d
gram_acceptor
_manager.cpp
View file @
211c30f4
...
...
@@ -17,18 +17,18 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/io/network/d
atagram_sink
_manager.hpp"
#include "caf/io/network/d
gram_acceptor
_manager.hpp"
namespace
caf
{
namespace
io
{
namespace
network
{
d
atagram_sink_manager
::
datagram_sink
_manager
(
abstract_broker
*
ptr
)
d
gram_acceptor_manager
::
dgram_acceptor
_manager
(
abstract_broker
*
ptr
)
:
manager
(
ptr
)
{
// nop
}
d
atagram_sink_manager
::~
datagram_sink
_manager
()
{
d
gram_acceptor_manager
::~
dgram_acceptor
_manager
()
{
// nop
}
...
...
libcaf_io/src/
endpoint
_manager.cpp
→
libcaf_io/src/
dgram_communicator
_manager.cpp
View file @
211c30f4
...
...
@@ -17,18 +17,18 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/io/network/
endpoint
_manager.hpp"
#include "caf/io/network/
dgram_communicator
_manager.hpp"
namespace
caf
{
namespace
io
{
namespace
network
{
endpoint_manager
::
endpoint
_manager
(
abstract_broker
*
ptr
)
dgram_communicator_manager
::
dgram_communicator
_manager
(
abstract_broker
*
ptr
)
:
manager
(
ptr
)
{
// nop
}
endpoint_manager
::~
endpoint
_manager
()
{
dgram_communicator_manager
::~
dgram_communicator
_manager
()
{
// nop
}
...
...
libcaf_io/src/d
atagram_sink
.cpp
→
libcaf_io/src/d
gram_doorman
.cpp
View file @
211c30f4
...
...
@@ -17,46 +17,39 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/io/d
atagram_sink
.hpp"
#include "caf/io/d
gram_doorman
.hpp"
#include "caf/logger.hpp"
namespace
caf
{
namespace
io
{
datagram_sink
::
datagram_sink
(
abstract_broker
*
parent
,
datagram_sink_handle
hdl
)
:
datagram_sink_base
(
parent
,
hdl
)
{
dgram_doorman
::
dgram_doorman
(
abstract_broker
*
parent
,
dgram_doorman_handle
hdl
)
:
dgram_doorman_base
(
parent
,
hdl
)
{
// nop
}
d
atagram_sink
::~
datagram_sink
()
{
d
gram_doorman
::~
dgram_doorman
()
{
CAF_LOG_TRACE
(
""
);
}
message
d
atagram_sink
::
detach_message
()
{
return
make_message
(
d
atagram_sink
_closed_msg
{
hdl
()});
message
d
gram_doorman
::
detach_message
()
{
return
make_message
(
d
gram_doorman
_closed_msg
{
hdl
()});
}
void
datagram_sink
::
datagram_sent
(
execution_unit
*
,
size_t
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
written
));
/*
if (detached())
return;
using sent_t = datagram_sent_msg;
using tmp_t = mailbox_element_vals<datagram_sent_msg>;
tmp_t tmp{strong_actor_ptr{}, message_id::make(),
mailbox_element::forwarding_stack{},
sent_t{hdl(), written}};
invoke_mailbox_element_impl(ctx, tmp);
*/
}
void
datagram_sink
::
io_failure
(
execution_unit
*
ctx
,
network
::
operation
op
)
{
void
dgram_doorman
::
io_failure
(
execution_unit
*
ctx
,
network
::
operation
op
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
())
<<
CAF_ARG
(
op
));
// keep compiler happy when compiling w/o logging
static_cast
<
void
>
(
op
);
detach
(
ctx
,
true
);
}
bool
dgram_doorman
::
new_endpoint
(
execution_unit
*
ctx
,
const
void
*
buf
,
size_t
besize
)
{
// TODO: implement me!
return
false
;
}
}
// namespace io
}
// namespace caf
libcaf_io/src/
endpoint
.cpp
→
libcaf_io/src/
dgram_scribe
.cpp
View file @
211c30f4
...
...
@@ -17,28 +17,28 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/io/endpoint.hpp"
#include "caf/io/dgram_scribe.hpp"
#include "caf/logger.hpp"
namespace
caf
{
namespace
io
{
endpoint
::
endpoint
(
abstract_broker
*
parent
,
endpoint
_handle
hdl
)
:
endpoint
_base
(
parent
,
hdl
)
{
dgram_scribe
::
dgram_scribe
(
abstract_broker
*
parent
,
dgram_scribe
_handle
hdl
)
:
dgram_scribe
_base
(
parent
,
hdl
)
{
// nop
}
endpoint
::~
endpoint
()
{
dgram_scribe
::~
dgram_scribe
()
{
CAF_LOG_TRACE
(
""
);
}
message
endpoint
::
detach_message
()
{
return
make_message
(
endpoint
_closed_msg
{
hdl
()});
message
dgram_scribe
::
detach_message
()
{
return
make_message
(
dgram_scribe
_closed_msg
{
hdl
()});
}
bool
endpoint
::
consume
(
execution_unit
*
ctx
,
const
void
*
,
size_t
num_bytes
)
{
bool
dgram_scribe
::
consume
(
execution_unit
*
ctx
,
const
void
*
,
size_t
num_bytes
)
{
CAF_ASSERT
(
ctx
!=
nullptr
);
CAF_LOG_TRACE
(
CAF_ARG
(
num_bytes
));
if
(
detached
())
...
...
@@ -63,7 +63,7 @@ bool endpoint::consume(execution_unit* ctx, const void*, size_t num_bytes) {
return
result
;
}
void
endpoint
::
datagram_sent
(
execution_unit
*
ctx
,
size_t
written
)
{
void
dgram_scribe
::
datagram_sent
(
execution_unit
*
ctx
,
size_t
written
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
written
));
if
(
detached
())
return
;
...
...
@@ -75,7 +75,7 @@ void endpoint::datagram_sent(execution_unit* ctx, size_t written) {
invoke_mailbox_element_impl
(
ctx
,
tmp
);
}
void
endpoint
::
io_failure
(
execution_unit
*
ctx
,
network
::
operation
op
)
{
void
dgram_scribe
::
io_failure
(
execution_unit
*
ctx
,
network
::
operation
op
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
hdl
())
<<
CAF_ARG
(
op
));
// keep compiler happy when compiling w/o logging
static_cast
<
void
>
(
op
);
...
...
libcaf_io/src/test_multiplexer.cpp
View file @
211c30f4
This diff is collapsed.
Click to expand it.
libcaf_io/test/datagram.cpp
View file @
211c30f4
...
...
@@ -72,7 +72,7 @@ behavior make_pong_behavior() {
}
// namespace <anonymous>
CAF_TEST_FIXTURE_SCOPE
(
datagrams
,
fixture
)
/*
CAF_TEST(test_remote_endpoint) {
auto& mp = client_side_mm.backend();
auto hdl = client_side_mm.named_broker<basp_broker>(atom("BASP"));
...
...
@@ -134,5 +134,5 @@ CAF_TEST(test_datagram_remote_actor) {
anon_send_exit(pong, exit_reason::user_shutdown);
}
*/
CAF_TEST_FIXTURE_SCOPE_END
()
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