Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
7045a4a2
Commit
7045a4a2
authored
Mar 15, 2011
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Dead code removed from named_session.cpp
Signed-off-by:
Martin Sustrik
<
sustrik@250bpm.com
>
parent
f987f4b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
44 deletions
+18
-44
named_session.cpp
src/named_session.cpp
+16
-41
named_session.hpp
src/named_session.hpp
+2
-3
No files found.
src/named_session.cpp
View file @
7045a4a2
...
...
@@ -23,63 +23,38 @@
zmq
::
named_session_t
::
named_session_t
(
class
io_thread_t
*
io_thread_
,
socket_base_t
*
socket_
,
const
options_t
&
options_
,
const
blob_t
&
name
_
)
:
const
blob_t
&
peer_identity
_
)
:
session_t
(
io_thread_
,
socket_
,
options_
),
name
(
name
_
)
peer_identity
(
peer_identity
_
)
{
// Make double sure that the
session has valid name
.
zmq_assert
(
!
name
.
empty
());
zmq_assert
(
name
[
0
]
!=
0
);
// Make double sure that the
peer's identity is not transient
.
zmq_assert
(
!
peer_identity
.
empty
());
zmq_assert
(
peer_identity
[
0
]
!=
0
);
if
(
!
socket_
->
register_session
(
name
,
this
))
{
bool
ok
=
socket_
->
register_session
(
peer_identity
,
this
);
// TODO: There's already a session with the specified
// identity. We should log the error and drop the
// session.
zmq_assert
(
false
);
}
// If new session is being created, the caller should have already
// checked that the session for specified identity doesn't exist yet.
// Thus, register_session should not fail.
zmq_assert
(
ok
);
}
zmq
::
named_session_t
::~
named_session_t
()
{
// Unregister the session from the global list of named sessions.
if
(
!
name
.
empty
())
unregister_session
(
name
);
unregister_session
(
peer_identity
);
}
void
zmq
::
named_session_t
::
attached
(
const
blob_t
&
peer_identity_
)
{
if
(
!
name
.
empty
())
{
// If both IDs are temporary, no checking is needed.
// TODO: Old ID should be reused in this case...
if
(
name
.
empty
()
||
name
[
0
]
!=
0
||
peer_identity_
.
empty
()
||
peer_identity_
[
0
]
!=
0
)
{
// If we already know the peer name do nothing, just check whether
// it haven't changed.
zmq_assert
(
name
==
peer_identity_
);
}
}
else
if
(
!
peer_identity_
.
empty
())
{
// Store the peer identity.
name
=
peer_identity_
;
// Register the session using the peer name.
if
(
!
register_session
(
name
,
this
))
{
// TODO: There's already a session with the specified
// identity. We should presumably syslog it and drop the
// session.
zmq_assert
(
false
);
}
}
// The owner should take care to not attach the session
// to an unrelated peer.
zmq_assert
(
peer_identity
==
peer_identity_
);
}
void
zmq
::
named_session_t
::
detached
()
{
// Do nothing. Named sessions are never destroyed because of disconnection
,
//
n
either they have to actively reconnect.
// Do nothing. Named sessions are never destroyed because of disconnection
.
//
N
either they have to actively reconnect.
}
src/named_session.hpp
View file @
7045a4a2
...
...
@@ -36,7 +36,7 @@ namespace zmq
named_session_t
(
class
io_thread_t
*
io_thread_
,
class
socket_base_t
*
socket_
,
const
options_t
&
options_
,
const
blob_t
&
name
_
);
const
blob_t
&
peer_identity
_
);
~
named_session_t
();
// Handlers for events from session base class.
...
...
@@ -45,8 +45,7 @@ namespace zmq
private
:
// Name of the session. Corresponds to the peer's strong identity.
blob_t
name
;
blob_t
peer_identity
;
named_session_t
(
const
named_session_t
&
);
const
named_session_t
&
operator
=
(
const
named_session_t
&
);
...
...
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