0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-14 17:58:01 +08:00

Merge pull request #2639 from bluca/wine_doc

Problems: using Wine requires system tuning, ZMQ_BINDTODEVICE not draft
This commit is contained in:
Jim Klimov 2017-08-01 15:39:45 +02:00 committed by GitHub
commit fda9daa200
5 changed files with 24 additions and 6 deletions

11
INSTALL
View File

@ -57,6 +57,17 @@ can cause substantial consumption of virtual address space, especially if
Generally, programmer needs to tune the stack to balance memory consumption
but never get into situation that stack is overflown.
Windows Builds - Wine
=====================
To use Windows binaries on *nix via Wine, it is necessary to ensure that the
kernel TCP buffers are large enough. On some systems, like OS X, they are too
small by default.
They need to be set to at least one MB as a workaround for issue:
https://github.com/zeromq/libzmq/issues/1608
sudo sysctl -w net.inet.tcp.sendspace=1300000
Basic Installation
==================

View File

@ -368,7 +368,6 @@ ZMQ_EXPORT const char *zmq_msg_gets (const zmq_msg_t *msg, const char *property)
#define ZMQ_VMCI_BUFFER_MAX_SIZE 87
#define ZMQ_VMCI_CONNECT_TIMEOUT 88
#define ZMQ_USE_FD 89
#define ZMQ_BINDTODEVICE 90
/* Message options */
#define ZMQ_MORE 1
@ -562,6 +561,9 @@ ZMQ_EXPORT void zmq_threadclose (void* thread);
#define ZMQ_SCATTER 17
#define ZMQ_DGRAM 18
/* DRAFT Socket options. */
#define ZMQ_BINDTODEVICE 90
/* DRAFT 0MQ socket events and monitoring */
#define ZMQ_EVENT_HANDSHAKE_FAILED 0x0800
#define ZMQ_EVENT_HANDSHAKE_SUCCEED 0x1000

View File

@ -101,6 +101,10 @@ void zmq::udp_engine_t::plug (io_thread_t* io_thread_, session_base_t *session_)
io_object_t::plug (io_thread_);
handle = add_fd (fd);
// Bind the socket to a device if applicable
if (!options.bound_device.empty ())
bind_to_device (fd, options.bound_device);
if (send_enabled) {
if (!options.raw_socket) {
out_address = address->resolved.udp_addr->dest_addr ();
@ -123,10 +127,6 @@ void zmq::udp_engine_t::plug (io_thread_t* io_thread_, session_base_t *session_)
errno_assert (rc == 0);
#endif
// Bind the socket to a device if applicable
if (!options.bound_device.empty ())
bind_to_device (fd, options.bound_device);
rc = bind (fd, address->resolved.udp_addr->bind_addr (),
address->resolved.udp_addr->bind_addrlen ());
#ifdef ZMQ_HAVE_WINDOWS

View File

@ -46,6 +46,9 @@
#define ZMQ_SCATTER 17
#define ZMQ_DGRAM 18
/* DRAFT Socket options. */
#define ZMQ_BINDTODEVICE 90
/* DRAFT 0MQ socket events and monitoring */
#define ZMQ_EVENT_HANDSHAKE_FAILED 0x0800
#define ZMQ_EVENT_HANDSHAKE_SUCCEED 0x1000

View File

@ -113,10 +113,11 @@ void test_setsockopt_use_fd ()
#define BOUNDDEVBUFSZ 16
void test_setsockopt_bindtodevice ()
{
int rc;
void *ctx = zmq_ctx_new ();
void *socket = zmq_socket (ctx, ZMQ_PUSH);
#ifdef ZMQ_BINDTODEVICE
int rc;
char devname[BOUNDDEVBUFSZ];
size_t buflen = BOUNDDEVBUFSZ;
@ -137,6 +138,7 @@ void test_setsockopt_bindtodevice ()
rc = zmq_getsockopt (socket, ZMQ_BINDTODEVICE, devname, &buflen);
assert(rc == 0);
assert(!strncmp("testdev", devname, buflen));
#endif
zmq_close (socket);
zmq_ctx_term (ctx);