Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
actor-incubator
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
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-incubator
Commits
29f9b037
Commit
29f9b037
authored
Sep 17, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Pass a pointer to the socket manager to all layers
parent
7e4d9505
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
9 deletions
+13
-9
libcaf_net/caf/net/socket_manager.hpp
libcaf_net/caf/net/socket_manager.hpp
+1
-1
libcaf_net/caf/net/stream_transport.hpp
libcaf_net/caf/net/stream_transport.hpp
+2
-2
libcaf_net/caf/net/web_socket.hpp
libcaf_net/caf/net/web_socket.hpp
+7
-3
libcaf_net/test/net-test.hpp
libcaf_net/test/net-test.hpp
+1
-1
libcaf_net/test/net/web_socket.cpp
libcaf_net/test/net/web_socket.cpp
+1
-1
libcaf_net/test/stream_transport.cpp
libcaf_net/test/stream_transport.cpp
+1
-1
No files found.
libcaf_net/caf/net/socket_manager.hpp
View file @
29f9b037
...
@@ -132,7 +132,7 @@ public:
...
@@ -132,7 +132,7 @@ public:
// -- initialization ---------------------------------------------------------
// -- initialization ---------------------------------------------------------
error
init
(
const
settings
&
config
)
override
{
error
init
(
const
settings
&
config
)
override
{
return
protocol_
.
init
(
*
this
,
config
);
return
protocol_
.
init
(
static_cast
<
socket_manager
*>
(
this
),
*
this
,
config
);
}
}
// -- event callbacks --------------------------------------------------------
// -- event callbacks --------------------------------------------------------
...
...
libcaf_net/caf/net/stream_transport.hpp
View file @
29f9b037
...
@@ -131,7 +131,7 @@ public:
...
@@ -131,7 +131,7 @@ public:
// -- initialization ---------------------------------------------------------
// -- initialization ---------------------------------------------------------
template
<
class
Parent
>
template
<
class
Parent
>
error
init
(
Parent
&
parent
,
const
settings
&
config
)
{
error
init
(
socket_manager
*
owner
,
Parent
&
parent
,
const
settings
&
config
)
{
namespace
mm
=
defaults
::
middleman
;
namespace
mm
=
defaults
::
middleman
;
auto
default_max_reads
=
static_cast
<
uint32_t
>
(
mm
::
max_consecutive_reads
);
auto
default_max_reads
=
static_cast
<
uint32_t
>
(
mm
::
max_consecutive_reads
);
max_consecutive_reads_
=
get_or
(
max_consecutive_reads_
=
get_or
(
...
@@ -153,7 +153,7 @@ public:
...
@@ -153,7 +153,7 @@ public:
return
std
::
move
(
socket_buf_size
.
error
());
return
std
::
move
(
socket_buf_size
.
error
());
}
}
access
<
Parent
>
this_layer
{
&
parent
,
this
};
access
<
Parent
>
this_layer
{
&
parent
,
this
};
return
upper_layer_
.
init
(
this_layer
,
config
);
return
upper_layer_
.
init
(
owner
,
this_layer
,
config
);
}
}
// -- event callbacks --------------------------------------------------------
// -- event callbacks --------------------------------------------------------
...
...
libcaf_net/caf/net/web_socket.hpp
View file @
29f9b037
...
@@ -21,9 +21,9 @@
...
@@ -21,9 +21,9 @@
#include <algorithm>
#include <algorithm>
#include "caf/detail/encode_base64.hpp"
#include "caf/detail/encode_base64.hpp"
#include "caf/detail/move_if_not_ptr.hpp"
#include "caf/error.hpp"
#include "caf/error.hpp"
#include "caf/hash/sha1.hpp"
#include "caf/hash/sha1.hpp"
#include "caf/net/fwd.hpp"
#include "caf/net/receive_policy.hpp"
#include "caf/net/receive_policy.hpp"
#include "caf/pec.hpp"
#include "caf/pec.hpp"
#include "caf/settings.hpp"
#include "caf/settings.hpp"
...
@@ -87,7 +87,8 @@ public:
...
@@ -87,7 +87,8 @@ public:
// -- initialization ---------------------------------------------------------
// -- initialization ---------------------------------------------------------
template
<
class
LowerLayer
>
template
<
class
LowerLayer
>
error
init
(
LowerLayer
&
down
,
const
settings
&
config
)
{
error
init
(
socket_manager
*
owner
,
LowerLayer
&
down
,
const
settings
&
config
)
{
owner_
=
owner
;
cfg_
=
config
;
cfg_
=
config
;
down
.
configure_read
(
net
::
receive_policy
::
up_to
(
max_header_size
));
down
.
configure_read
(
net
::
receive_policy
::
up_to
(
max_header_size
));
return
none
;
return
none
;
...
@@ -199,7 +200,7 @@ private:
...
@@ -199,7 +200,7 @@ private:
return
false
;
return
false
;
}
}
// Try initializing the upper layer.
// Try initializing the upper layer.
if
(
auto
err
=
upper_layer_
.
init
(
down
,
cfg_
))
{
if
(
auto
err
=
upper_layer_
.
init
(
owner_
,
down
,
cfg_
))
{
down
.
abort_reason
(
std
::
move
(
err
));
down
.
abort_reason
(
std
::
move
(
err
));
return
false
;
return
false
;
}
}
...
@@ -266,6 +267,9 @@ private:
...
@@ -266,6 +267,9 @@ private:
/// Stores the upper layer.
/// Stores the upper layer.
UpperLayer
upper_layer_
;
UpperLayer
upper_layer_
;
/// Stores a pointer to the owning manager for the delayed initialization.
socket_manager
*
owner_
=
nullptr
;
/// Holds a copy of the settings in order to delay initialization of the upper
/// Holds a copy of the settings in order to delay initialization of the upper
/// layer until the handshake completed.
/// layer until the handshake completed.
settings
cfg_
;
settings
cfg_
;
...
...
libcaf_net/test/net-test.hpp
View file @
29f9b037
...
@@ -59,7 +59,7 @@ public:
...
@@ -59,7 +59,7 @@ public:
caf
::
error
init
(
const
caf
::
settings
&
config
)
{
caf
::
error
init
(
const
caf
::
settings
&
config
)
{
access
this_layer
{
this
};
access
this_layer
{
this
};
return
upper_layer
.
init
(
this_layer
,
config
);
return
upper_layer
.
init
(
nullptr
,
this_layer
,
config
);
}
}
caf
::
error
init
()
{
caf
::
error
init
()
{
...
...
libcaf_net/test/net/web_socket.cpp
View file @
29f9b037
...
@@ -42,7 +42,7 @@ struct app_t {
...
@@ -42,7 +42,7 @@ struct app_t {
settings
cfg
;
settings
cfg
;
template
<
class
LowerLayer
>
template
<
class
LowerLayer
>
error
init
(
LowerLayer
&
,
const
settings
&
init_cfg
)
{
error
init
(
net
::
socket_manager
*
,
LowerLayer
&
,
const
settings
&
init_cfg
)
{
cfg
=
init_cfg
;
cfg
=
init_cfg
;
return
none
;
return
none
;
}
}
...
...
libcaf_net/test/stream_transport.cpp
View file @
29f9b037
...
@@ -87,7 +87,7 @@ public:
...
@@ -87,7 +87,7 @@ public:
~
dummy_application
()
=
default
;
~
dummy_application
()
=
default
;
template
<
class
Parent
>
template
<
class
Parent
>
error
init
(
Parent
&
parent
,
const
settings
&
)
{
error
init
(
socket_manager
*
,
Parent
&
parent
,
const
settings
&
)
{
parent
.
configure_read
(
receive_policy
::
exactly
(
hello_manager
.
size
()));
parent
.
configure_read
(
receive_policy
::
exactly
(
hello_manager
.
size
()));
return
none
;
return
none
;
}
}
...
...
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