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
77514e0e
Commit
77514e0e
authored
May 21, 2014
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1053 from hurtonm/master
Code cleanup
parents
96501d72
414fc86b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
20 deletions
+26
-20
ctx.cpp
src/ctx.cpp
+9
-5
ctx.hpp
src/ctx.hpp
+9
-9
object.cpp
src/object.cpp
+3
-2
object.hpp
src/object.hpp
+3
-1
socket_base.cpp
src/socket_base.cpp
+2
-3
No files found.
src/ctx.cpp
View file @
77514e0e
...
...
@@ -405,19 +405,23 @@ zmq::endpoint_t zmq::ctx_t::find_endpoint (const char *addr_)
return
endpoint
;
}
void
zmq
::
ctx_t
::
pend_connection
(
const
char
*
addr_
,
pending_connection_t
&
pending_connection_
)
void
zmq
::
ctx_t
::
pend_connection
(
const
std
::
string
&
addr_
,
const
endpoint_t
&
endpoint_
,
pipe_t
**
pipes_
)
{
const
pending_connection_t
pending_connection
=
{
endpoint_
,
pipes_
[
0
],
pipes_
[
1
]};
endpoints_sync
.
lock
();
endpoints_t
::
iterator
it
=
endpoints
.
find
(
addr_
);
if
(
it
==
endpoints
.
end
())
{
// Still no bind.
pending_connection_
.
endpoint
.
socket
->
inc_seqnum
();
pending_connections
.
insert
(
pending_connections_t
::
value_type
(
std
::
string
(
addr_
),
pending_connection_
));
endpoint_
.
socket
->
inc_seqnum
();
pending_connections
.
insert
(
pending_connections_t
::
value_type
(
addr_
,
pending_connection
));
}
else
// Bind has happened in the mean time, connect directly
connect_inproc_sockets
(
it
->
second
.
socket
,
it
->
second
.
options
,
pending_connection_
,
connect_side
);
connect_inproc_sockets
(
it
->
second
.
socket
,
it
->
second
.
options
,
pending_connection
,
connect_side
);
endpoints_sync
.
unlock
();
}
...
...
@@ -436,7 +440,7 @@ void zmq::ctx_t::connect_pending (const char *addr_, zmq::socket_base_t *bind_so
}
void
zmq
::
ctx_t
::
connect_inproc_sockets
(
zmq
::
socket_base_t
*
bind_socket_
,
options_t
&
bind_options
,
pending_connection_t
&
pending_connection_
,
side
side_
)
options_t
&
bind_options
,
const
pending_connection_t
&
pending_connection_
,
side
side_
)
{
bind_socket_
->
inc_seqnum
();
pending_connection_
.
bind_pipe
->
set_tid
(
bind_socket_
->
get_tid
());
...
...
src/ctx.hpp
View file @
77514e0e
...
...
@@ -51,13 +51,6 @@ namespace zmq
options_t
options
;
};
struct
pending_connection_t
{
endpoint_t
endpoint
;
pipe_t
*
connect_pipe
;
pipe_t
*
bind_pipe
;
};
// Context object encapsulates all the global state associated with
// the library.
...
...
@@ -109,7 +102,8 @@ namespace zmq
int
register_endpoint
(
const
char
*
addr_
,
endpoint_t
&
endpoint_
);
void
unregister_endpoints
(
zmq
::
socket_base_t
*
socket_
);
endpoint_t
find_endpoint
(
const
char
*
addr_
);
void
pend_connection
(
const
char
*
addr_
,
pending_connection_t
&
pending_connection_
);
void
pend_connection
(
const
std
::
string
&
addr_
,
const
endpoint_t
&
endpoint_
,
pipe_t
**
pipes_
);
void
connect_pending
(
const
char
*
addr_
,
zmq
::
socket_base_t
*
bind_socket_
);
enum
{
...
...
@@ -121,6 +115,12 @@ namespace zmq
private
:
struct
pending_connection_t
{
endpoint_t
endpoint
;
pipe_t
*
connect_pipe
;
pipe_t
*
bind_pipe
;
};
// Used to check whether the object is a context.
uint32_t
tag
;
...
...
@@ -196,7 +196,7 @@ namespace zmq
pid_t
pid
;
#endif
enum
side
{
connect_side
,
bind_side
};
void
connect_inproc_sockets
(
zmq
::
socket_base_t
*
bind_socket_
,
options_t
&
bind_options
,
pending_connection_t
&
pending_connection_
,
side
side_
);
void
connect_inproc_sockets
(
zmq
::
socket_base_t
*
bind_socket_
,
options_t
&
bind_options
,
const
pending_connection_t
&
pending_connection_
,
side
side_
);
};
}
...
...
src/object.cpp
View file @
77514e0e
...
...
@@ -152,9 +152,10 @@ zmq::endpoint_t zmq::object_t::find_endpoint (const char *addr_)
return
ctx
->
find_endpoint
(
addr_
);
}
void
zmq
::
object_t
::
pend_connection
(
const
char
*
addr_
,
pending_connection_t
&
pending_connection_
)
void
zmq
::
object_t
::
pend_connection
(
const
std
::
string
&
addr_
,
const
endpoint_t
&
endpoint_
,
pipe_t
**
pipes_
)
{
ctx
->
pend_connection
(
addr_
,
pending_connection
_
);
ctx
->
pend_connection
(
addr_
,
endpoint_
,
pipes
_
);
}
void
zmq
::
object_t
::
connect_pending
(
const
char
*
addr_
,
zmq
::
socket_base_t
*
bind_socket_
)
...
...
src/object.hpp
View file @
77514e0e
...
...
@@ -20,6 +20,7 @@
#ifndef __ZMQ_OBJECT_HPP_INCLUDED__
#define __ZMQ_OBJECT_HPP_INCLUDED__
#include <string>
#include "stdint.hpp"
namespace
zmq
...
...
@@ -61,7 +62,8 @@ namespace zmq
int
register_endpoint
(
const
char
*
addr_
,
zmq
::
endpoint_t
&
endpoint_
);
void
unregister_endpoints
(
zmq
::
socket_base_t
*
socket_
);
zmq
::
endpoint_t
find_endpoint
(
const
char
*
addr_
);
void
pend_connection
(
const
char
*
addr_
,
pending_connection_t
&
pending_connection_
);
void
pend_connection
(
const
std
::
string
&
addr_
,
const
endpoint_t
&
endpoint
,
pipe_t
**
pipes_
);
void
connect_pending
(
const
char
*
addr_
,
zmq
::
socket_base_t
*
bind_socket_
);
void
destroy_socket
(
zmq
::
socket_base_t
*
socket_
);
...
...
src/socket_base.cpp
View file @
77514e0e
...
...
@@ -527,9 +527,8 @@ int zmq::socket_base_t::connect (const char *addr_)
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
);
const
endpoint_t
endpoint
=
{
this
,
options
};
pend_connection
(
std
::
string
(
addr_
),
endpoint
,
new_pipes
);
}
else
{
...
...
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