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
a0940782
Commit
a0940782
authored
Feb 09, 2014
by
Martin Hurton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix identity handling for inproc transport
Fixes #872
parent
8cda54c5
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
14 deletions
+23
-14
ctx.cpp
src/ctx.cpp
+6
-10
pipe.cpp
src/pipe.cpp
+3
-2
socket_base.cpp
src/socket_base.cpp
+14
-2
No files found.
src/ctx.cpp
View file @
a0940782
...
...
@@ -455,18 +455,14 @@ void zmq::ctx_t::connect_inproc_sockets (zmq::socket_base_t *bind_socket_,
pending_connection_
.
connect_pipe
->
set_hwms
(
hwms
[
1
],
hwms
[
0
]);
pending_connection_
.
bind_pipe
->
set_hwms
(
hwms
[
0
],
hwms
[
1
]);
if
(
bind_options
.
recv_identity
)
{
msg_t
id
;
int
rc
=
id
.
init_size
(
pending_connection_
.
endpoint
.
options
.
identity_size
);
if
(
!
bind_options
.
recv_identity
)
{
msg_t
msg
;
const
bool
ok
=
pending_connection_
.
bind_pipe
->
read
(
&
msg
);
zmq_assert
(
ok
);
const
int
rc
=
msg
.
close
();
errno_assert
(
rc
==
0
);
memcpy
(
id
.
data
(),
pending_connection_
.
endpoint
.
options
.
identity
,
pending_connection_
.
endpoint
.
options
.
identity_size
);
id
.
set_flags
(
msg_t
::
identity
);
bool
written
=
pending_connection_
.
connect_pipe
->
write
(
&
id
);
zmq_assert
(
written
);
pending_connection_
.
connect_pipe
->
flush
();
}
if
(
pending_connection_
.
endpoint
.
options
.
recv_identity
)
{
msg_t
id
;
int
rc
=
id
.
init_size
(
bind_options
.
identity_size
);
...
...
src/pipe.cpp
View file @
a0940782
...
...
@@ -169,7 +169,7 @@ read_message:
return
false
;
}
if
(
!
(
msg_
->
flags
()
&
msg_t
::
more
))
if
(
!
(
msg_
->
flags
()
&
msg_t
::
more
)
&&
!
msg_
->
is_identity
()
)
msgs_read
++
;
if
(
lwm
>
0
&&
msgs_read
%
lwm
==
0
)
...
...
@@ -199,8 +199,9 @@ bool zmq::pipe_t::write (msg_t *msg_)
return
false
;
bool
more
=
msg_
->
flags
()
&
msg_t
::
more
?
true
:
false
;
const
bool
is_identity
=
msg_
->
is_identity
();
outpipe
->
write
(
*
msg_
,
more
);
if
(
!
more
)
if
(
!
more
&&
!
is_identity
)
msgs_written
++
;
return
true
;
...
...
src/socket_base.cpp
View file @
a0940782
...
...
@@ -503,8 +503,20 @@ int zmq::socket_base_t::connect (const char *addr_)
// Attach local end of the pipe to this socket object.
attach_pipe
(
new_pipes
[
0
]);
if
(
!
peer
.
socket
)
{
if
(
!
peer
.
socket
)
{
// The peer doesn't exist yet so we don't know whether
// to send the identity message or not. To resolve this,
// we always send our identity and drop it later if
// the peer doesn't expect it.
msg_t
id
;
rc
=
id
.
init_size
(
options
.
identity_size
);
errno_assert
(
rc
==
0
);
memcpy
(
id
.
data
(),
options
.
identity
,
options
.
identity_size
);
id
.
set_flags
(
msg_t
::
identity
);
bool
written
=
new_pipes
[
0
]
->
write
(
&
id
);
zmq_assert
(
written
);
new_pipes
[
0
]
->
flush
();
endpoint_t
endpoint
=
{
this
,
options
};
pending_connection_t
pending_connection
=
{
endpoint
,
new_pipes
[
0
],
new_pipes
[
1
]};
pend_connection
(
addr_
,
pending_connection
);
...
...
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