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
5eccd874
Commit
5eccd874
authored
Feb 09, 2016
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1785 from bluca/one_more_rename
Problem: ZMQ_USEFD does not follow conventions
parents
15846f2f
edc4ee03
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
35 additions
and
35 deletions
+35
-35
.gitignore
.gitignore
+2
-2
Makefile.am
Makefile.am
+8
-8
zmq_getsockopt.txt
doc/zmq_getsockopt.txt
+2
-2
zmq_setsockopt.txt
doc/zmq_setsockopt.txt
+1
-1
zmq.h
include/zmq.h
+1
-1
ipc_listener.cpp
src/ipc_listener.cpp
+4
-4
options.cpp
src/options.cpp
+5
-5
options.hpp
src/options.hpp
+1
-1
tcp_listener.cpp
src/tcp_listener.cpp
+2
-2
CMakeLists.txt
tests/CMakeLists.txt
+2
-2
test_setsockopt.cpp
tests/test_setsockopt.cpp
+5
-5
test_use_fd_ipc.cpp
tests/test_use_fd_ipc.cpp
+1
-1
test_use_fd_tcp.cpp
tests/test_use_fd_tcp.cpp
+1
-1
No files found.
.gitignore
View file @
5eccd874
...
...
@@ -125,8 +125,8 @@ test_timers
test_radio_dish
test_udp
test_large_msg
test_usefd_ipc
test_usefd_tcp
test_use
_
fd_ipc
test_use
_
fd_tcp
tests/test*.log
tests/test*.trs
src/platform.hpp*
...
...
Makefile.am
View file @
5eccd874
...
...
@@ -626,8 +626,8 @@ test_apps += \
tests/test_shutdown_stress
\
tests/test_pair_ipc
\
tests/test_reqrep_ipc
\
tests/test_usefd_ipc
\
tests/test_usefd_tcp
\
tests/test_use
_
fd_ipc
\
tests/test_use
_
fd_tcp
\
tests/test_timeo
\
tests/test_filter_ipc
...
...
@@ -650,15 +650,15 @@ tests_test_timeo_LDADD = src/libzmq.la
tests_test_filter_ipc_SOURCES
=
tests/test_filter_ipc.cpp
tests_test_filter_ipc_LDADD
=
src/libzmq.la
tests_test_usefd_ipc_SOURCES
=
\
tests/test_usefd_ipc.cpp
\
tests_test_use
_
fd_ipc_SOURCES
=
\
tests/test_use
_
fd_ipc.cpp
\
tests/testutil.hpp
tests_test_usefd_ipc_LDADD
=
src/libzmq.la
tests_test_use
_
fd_ipc_LDADD
=
src/libzmq.la
tests_test_usefd_tcp_SOURCES
=
\
tests/test_usefd_tcp.cpp
\
tests_test_use
_
fd_tcp_SOURCES
=
\
tests/test_use
_
fd_tcp.cpp
\
tests/testutil.hpp
tests_test_usefd_tcp_LDADD
=
src/libzmq.la
tests_test_use
_
fd_tcp_LDADD
=
src/libzmq.la
if
HAVE_FORK
test_apps
+=
tests/test_fork
...
...
doc/zmq_getsockopt.txt
View file @
5eccd874
...
...
@@ -464,9 +464,9 @@ Default value:: null string
Applicable socket types:: all, when using TCP or IPC transports
ZMQ_USEFD: Retrieve the pre-allocated socket file descriptor
ZMQ_USE
_
FD: Retrieve the pre-allocated socket file descriptor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The 'ZMQ_USEFD' option shall retrieve the pre-allocated file
The 'ZMQ_USE
_
FD' option shall retrieve the pre-allocated file
descriptor that has been assigned to a ZMQ socket, if any. -1 shall be
returned if a pre-allocated file descriptor was not set for the socket.
...
...
doc/zmq_setsockopt.txt
View file @
5eccd874
...
...
@@ -492,7 +492,7 @@ Default value:: not set
Applicable socket types:: all, when using TCP transport
ZMQ_USEFD: Set the pre-allocated socket file descriptor
ZMQ_USE
_
FD: Set the pre-allocated socket file descriptor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When set to a positive integer value before zmq_bind is called on the socket,
the socket shall use the corresponding file descriptor for connections over
...
...
include/zmq.h
View file @
5eccd874
...
...
@@ -344,7 +344,7 @@ ZMQ_EXPORT const char *zmq_msg_group (zmq_msg_t *msg);
#define ZMQ_VMCI_BUFFER_MIN_SIZE 86
#define ZMQ_VMCI_BUFFER_MAX_SIZE 87
#define ZMQ_VMCI_CONNECT_TIMEOUT 88
#define ZMQ_USEFD 89
#define ZMQ_USE
_
FD 89
/* Message options */
#define ZMQ_MORE 1
...
...
src/ipc_listener.cpp
View file @
5eccd874
...
...
@@ -158,7 +158,7 @@ int zmq::ipc_listener_t::set_address (const char *addr_)
// MUST NOT unlink if the FD is managed by the user, or it will stop
// working after the first client connects. The user will take care of
// cleaning up the file after the service is stopped.
if
(
options
.
usefd
==
-
1
)
{
if
(
options
.
use
_
fd
==
-
1
)
{
::
unlink
(
addr
.
c_str
());
}
filename
.
clear
();
...
...
@@ -171,8 +171,8 @@ int zmq::ipc_listener_t::set_address (const char *addr_)
address
.
to_string
(
endpoint
);
if
(
options
.
usefd
!=
-
1
)
{
s
=
options
.
usefd
;
if
(
options
.
use
_
fd
!=
-
1
)
{
s
=
options
.
use
_
fd
;
}
else
{
// Create a listening socket.
s
=
open_socket
(
AF_UNIX
,
SOCK_STREAM
,
0
);
...
...
@@ -216,7 +216,7 @@ int zmq::ipc_listener_t::close ()
// MUST NOT unlink if the FD is managed by the user, or it will stop
// working after the first client connects. The user will take care of
// cleaning up the file after the service is stopped.
if
(
has_file
&&
!
filename
.
empty
()
&&
options
.
usefd
==
-
1
)
{
if
(
has_file
&&
!
filename
.
empty
()
&&
options
.
use
_
fd
==
-
1
)
{
rc
=
::
unlink
(
filename
.
c_str
());
if
(
rc
!=
0
)
{
socket
->
event_close_failed
(
endpoint
,
zmq_errno
());
...
...
src/options.cpp
View file @
5eccd874
...
...
@@ -78,7 +78,7 @@ zmq::options_t::options_t () :
heartbeat_ttl
(
0
),
heartbeat_interval
(
0
),
heartbeat_timeout
(
-
1
),
usefd
(
-
1
)
use
_
fd
(
-
1
)
{
#if defined ZMQ_HAVE_VMCI
vmci_buffer_size
=
0
;
...
...
@@ -623,9 +623,9 @@ int zmq::options_t::setsockopt (int option_, const void *optval_,
break
;
# endif
case
ZMQ_USEFD
:
case
ZMQ_USE
_
FD
:
if
(
is_int
&&
value
>=
-
1
)
{
usefd
=
value
;
use
_
fd
=
value
;
return
0
;
}
break
;
...
...
@@ -1040,9 +1040,9 @@ int zmq::options_t::getsockopt (int option_, void *optval_, size_t *optvallen_)
}
break
;
case
ZMQ_USEFD
:
case
ZMQ_USE
_
FD
:
if
(
is_int
)
{
*
value
=
usefd
;
*
value
=
use
_
fd
;
return
0
;
}
break
;
...
...
src/options.hpp
View file @
5eccd874
...
...
@@ -235,7 +235,7 @@ namespace zmq
// When creating a new ZMQ socket, if this option is set the value
// will be used as the File Descriptor instead of allocating a new
// one via the socket () system call.
int
usefd
;
int
use
_
fd
;
};
}
...
...
src/tcp_listener.cpp
View file @
5eccd874
...
...
@@ -168,8 +168,8 @@ int zmq::tcp_listener_t::set_address (const char *addr_)
address
.
to_string
(
endpoint
);
if
(
options
.
usefd
!=
-
1
)
{
s
=
options
.
usefd
;
if
(
options
.
use
_
fd
!=
-
1
)
{
s
=
options
.
use
_
fd
;
socket
->
event_listening
(
endpoint
,
(
int
)
s
);
return
0
;
}
...
...
tests/CMakeLists.txt
View file @
5eccd874
...
...
@@ -90,8 +90,8 @@ if(NOT WIN32)
test_stream_exceeds_buffer
test_router_mandatory_hwm
test_term_endpoint_tipc
test_usefd_ipc
test_usefd_tcp
test_use
_
fd_ipc
test_use
_
fd_tcp
)
if
(
HAVE_FORK
)
list
(
APPEND tests test_fork
)
...
...
tests/test_setsockopt.cpp
View file @
5eccd874
...
...
@@ -70,7 +70,7 @@ void test_setsockopt_tcp_send_buffer()
zmq_ctx_term
(
ctx
);
}
void
test_setsockopt_usefd
()
void
test_setsockopt_use
_
fd
()
{
int
rc
;
void
*
ctx
=
zmq_ctx_new
();
...
...
@@ -79,17 +79,17 @@ void test_setsockopt_usefd()
int
val
=
0
;
size_t
placeholder
=
sizeof
(
val
);
rc
=
zmq_getsockopt
(
socket
,
ZMQ_USEFD
,
&
val
,
&
placeholder
);
rc
=
zmq_getsockopt
(
socket
,
ZMQ_USE
_
FD
,
&
val
,
&
placeholder
);
assert
(
rc
==
0
);
assert
(
val
==
-
1
);
val
=
3
;
rc
=
zmq_setsockopt
(
socket
,
ZMQ_USEFD
,
&
val
,
sizeof
(
val
));
rc
=
zmq_setsockopt
(
socket
,
ZMQ_USE
_
FD
,
&
val
,
sizeof
(
val
));
assert
(
rc
==
0
);
assert
(
val
==
3
);
rc
=
zmq_getsockopt
(
socket
,
ZMQ_USEFD
,
&
val
,
&
placeholder
);
rc
=
zmq_getsockopt
(
socket
,
ZMQ_USE
_
FD
,
&
val
,
&
placeholder
);
assert
(
rc
==
0
);
assert
(
val
==
3
);
...
...
@@ -102,5 +102,5 @@ int main()
{
test_setsockopt_tcp_recv_buffer
();
test_setsockopt_tcp_send_buffer
();
test_setsockopt_usefd
();
test_setsockopt_use
_
fd
();
}
tests/test_usefd_ipc.cpp
→
tests/test_use
_
fd_ipc.cpp
View file @
5eccd874
...
...
@@ -50,7 +50,7 @@ void pre_allocate_sock (void *zmq_socket, const char *path)
rc
=
listen
(
s_pre
,
SOMAXCONN
);
assert
(
rc
==
0
);
rc
=
zmq_setsockopt
(
zmq_socket
,
ZMQ_USEFD
,
&
s_pre
,
rc
=
zmq_setsockopt
(
zmq_socket
,
ZMQ_USE
_
FD
,
&
s_pre
,
sizeof
(
s_pre
));
assert
(
rc
==
0
);
}
...
...
tests/test_usefd_tcp.cpp
→
tests/test_use
_
fd_tcp.cpp
View file @
5eccd874
...
...
@@ -52,7 +52,7 @@ void pre_allocate_sock (void *zmq_socket, const char *address,
rc
=
listen
(
s_pre
,
SOMAXCONN
);
assert
(
rc
==
0
);
rc
=
zmq_setsockopt
(
zmq_socket
,
ZMQ_USEFD
,
&
s_pre
,
rc
=
zmq_setsockopt
(
zmq_socket
,
ZMQ_USE
_
FD
,
&
s_pre
,
sizeof
(
s_pre
));
assert
(
rc
==
0
);
}
...
...
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