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
aef6f0a4
Commit
aef6f0a4
authored
Sep 25, 2014
by
neverlord
Committed by
Dominik Charousset
Sep 29, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove `invalid_connection_handle`
parent
478f539d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
18 deletions
+29
-18
libcaf_io/caf/io/connection_handle.hpp
libcaf_io/caf/io/connection_handle.hpp
+7
-10
libcaf_io/caf/io/handle.hpp
libcaf_io/caf/io/handle.hpp
+21
-7
libcaf_io/src/basp_broker.cpp
libcaf_io/src/basp_broker.cpp
+1
-1
No files found.
libcaf_io/caf/io/connection_handle.hpp
View file @
aef6f0a4
...
@@ -29,23 +29,20 @@ namespace io {
...
@@ -29,23 +29,20 @@ namespace io {
* Generic handle type for identifying connections.
* Generic handle type for identifying connections.
*/
*/
class
connection_handle
:
public
handle
<
connection_handle
>
{
class
connection_handle
:
public
handle
<
connection_handle
>
{
public:
friend
class
handle
<
connection_handle
>
;
friend
class
handle
<
connection_handle
>
;
using
super
=
handle
<
connection_handle
>
;
using
super
=
handle
<
connection_handle
>
;
public:
constexpr
connection_handle
()
{
// nop
constexpr
connection_handle
()
{
}
}
private:
private:
inline
connection_handle
(
int64_t
handle_id
)
:
super
{
handle_id
}
{
inline
connection_handle
(
int64_t
handle_id
)
:
super
{
handle_id
}
{}
// nop
}
};
};
constexpr
connection_handle
invalid_connection_handle
=
connection_handle
{};
}
// namespace io
}
// namespace io
}
// namespace caf
}
// namespace caf
...
...
libcaf_io/caf/io/handle.hpp
View file @
aef6f0a4
...
@@ -36,7 +36,9 @@ class handle : detail::comparable<Subtype> {
...
@@ -36,7 +36,9 @@ class handle : detail::comparable<Subtype> {
// nop
// nop
}
}
handle
(
const
Subtype
&
other
)
{
m_id
=
other
.
id
();
}
handle
(
const
Subtype
&
other
)
{
m_id
=
other
.
id
();
}
handle
(
const
handle
&
other
)
=
default
;
handle
(
const
handle
&
other
)
=
default
;
...
@@ -48,25 +50,37 @@ class handle : detail::comparable<Subtype> {
...
@@ -48,25 +50,37 @@ class handle : detail::comparable<Subtype> {
/**
/**
* Returns the unique identifier of this handle.
* Returns the unique identifier of this handle.
*/
*/
inline
int64_t
id
()
const
{
return
m_id
;
}
int64_t
id
()
const
{
return
m_id
;
}
/**
/**
* Sets the unique identifier of this handle.
* Sets the unique identifier of this handle.
*/
*/
inline
void
set_id
(
int64_t
value
)
{
m_id
=
value
;
}
void
set_id
(
int64_t
value
)
{
m_id
=
value
;
}
in
line
in
t64_t
compare
(
const
Subtype
&
other
)
const
{
int64_t
compare
(
const
Subtype
&
other
)
const
{
return
m_id
-
other
.
id
();
return
m_id
-
other
.
id
();
}
}
inline
bool
invalid
()
const
{
return
m_id
==
-
1
;
}
bool
invalid
()
const
{
return
m_id
==
InvalidId
;
}
void
set_invalid
()
{
set_id
(
InvalidId
);
}
static
inline
Subtype
from_int
(
int64_t
id
)
{
static
Subtype
from_int
(
int64_t
id
)
{
return
{
id
};
return
{
id
};
}
}
protected:
protected:
inline
handle
(
int64_t
handle_id
)
:
m_id
{
handle_id
}
{}
handle
(
int64_t
handle_id
)
:
m_id
{
handle_id
}
{
// nop
}
private:
private:
int64_t
m_id
;
int64_t
m_id
;
...
...
libcaf_io/src/basp_broker.cpp
View file @
aef6f0a4
...
@@ -74,7 +74,7 @@ behavior basp_broker::make_behavior() {
...
@@ -74,7 +74,7 @@ behavior basp_broker::make_behavior() {
auto
&
entry
=
kvp
.
second
;
auto
&
entry
=
kvp
.
second
;
if
(
entry
.
first
.
hdl
==
msg
.
handle
)
{
if
(
entry
.
first
.
hdl
==
msg
.
handle
)
{
CAF_LOG_DEBUG
(
"lost direct connection to "
<<
to_string
(
kvp
.
first
));
CAF_LOG_DEBUG
(
"lost direct connection to "
<<
to_string
(
kvp
.
first
));
entry
.
first
.
hdl
=
invalid_connection_handle
;
entry
.
first
.
hdl
.
set_invalid
()
;
}
}
auto
last
=
entry
.
second
.
end
();
auto
last
=
entry
.
second
.
end
();
auto
i
=
std
::
lower_bound
(
entry
.
second
.
begin
(),
last
,
msg
.
handle
,
auto
i
=
std
::
lower_bound
(
entry
.
second
.
begin
(),
last
,
msg
.
handle
,
...
...
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