mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-17 16:43:58 +00:00
commit
8b9a82476b
10
NEWS
10
NEWS
@ -1,3 +1,13 @@
|
|||||||
|
0MQ version 4.0.3 stable, released on 2013/11/24
|
||||||
|
================================================
|
||||||
|
|
||||||
|
Bug Fixes
|
||||||
|
---------
|
||||||
|
|
||||||
|
* Fixed test_many_sockets case, which failed when process socket limit
|
||||||
|
was 1024.
|
||||||
|
|
||||||
|
|
||||||
0MQ version 4.0.2 stable, released on 2013/11/24
|
0MQ version 4.0.2 stable, released on 2013/11/24
|
||||||
================================================
|
================================================
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
/* Version macros for compile-time API version detection */
|
/* Version macros for compile-time API version detection */
|
||||||
#define ZMQ_VERSION_MAJOR 4
|
#define ZMQ_VERSION_MAJOR 4
|
||||||
#define ZMQ_VERSION_MINOR 0
|
#define ZMQ_VERSION_MINOR 0
|
||||||
#define ZMQ_VERSION_PATCH 2
|
#define ZMQ_VERSION_PATCH 3
|
||||||
|
|
||||||
#define ZMQ_MAKE_VERSION(major, minor, patch) \
|
#define ZMQ_MAKE_VERSION(major, minor, patch) \
|
||||||
((major) * 10000 + (minor) * 100 + (patch))
|
((major) * 10000 + (minor) * 100 + (patch))
|
||||||
|
@ -23,76 +23,65 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
void test_system_max ()
|
void test_system_max ()
|
||||||
{
|
{
|
||||||
// Keep allocating sockets until we run out of system resources
|
// Keep allocating sockets until we run out of system resources
|
||||||
|
|
||||||
const int no_of_sockets = 2 * 65536;
|
const int no_of_sockets = 2 * 65536;
|
||||||
void *ctx = zmq_ctx_new();
|
void *ctx = zmq_ctx_new ();
|
||||||
zmq_ctx_set(ctx, ZMQ_MAX_SOCKETS, no_of_sockets);
|
zmq_ctx_set (ctx, ZMQ_MAX_SOCKETS, no_of_sockets);
|
||||||
std::vector<void*> sockets;
|
std::vector <void*> sockets;
|
||||||
|
|
||||||
while (true)
|
while (true) {
|
||||||
{
|
void *socket = zmq_socket (ctx, ZMQ_PAIR);
|
||||||
void *socket = zmq_socket(ctx, ZMQ_PAIR);
|
|
||||||
if (!socket)
|
if (!socket)
|
||||||
break;
|
break;
|
||||||
|
sockets.push_back (socket);
|
||||||
sockets.push_back(socket);
|
|
||||||
}
|
}
|
||||||
|
assert ((int) sockets.size () < no_of_sockets);
|
||||||
|
|
||||||
assert((int)sockets.size() < no_of_sockets);
|
// System is out of resources, further calls to zmq_socket should return NULL
|
||||||
|
for (unsigned int i = 0; i < 10; ++i) {
|
||||||
// System is out of resources, further calls to zmq_socket should return NULL.
|
void *socket = zmq_socket (ctx, ZMQ_PAIR);
|
||||||
for (unsigned int i = 0; i < 10; ++i)
|
assert (socket == NULL);
|
||||||
{
|
|
||||||
void *socket = zmq_socket(ctx, ZMQ_PAIR);
|
|
||||||
assert(socket == NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clean up.
|
// Clean up.
|
||||||
for (unsigned int i = 0; i < sockets.size(); ++i)
|
for (unsigned int i = 0; i < sockets.size (); ++i)
|
||||||
zmq_close(sockets[i]);
|
zmq_close (sockets [i]);
|
||||||
|
|
||||||
zmq_ctx_destroy(ctx);
|
zmq_ctx_destroy (ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_zmq_default_max ()
|
void test_zmq_default_max ()
|
||||||
{
|
{
|
||||||
// Keep allocating sockets until we hit the default zeromq limit
|
// Keep allocating sockets until we hit the default limit
|
||||||
|
void *ctx = zmq_ctx_new ();
|
||||||
void *ctx = zmq_ctx_new();
|
|
||||||
std::vector<void*> sockets;
|
std::vector<void*> sockets;
|
||||||
|
|
||||||
while (true)
|
while (true) {
|
||||||
{
|
void *socket = zmq_socket (ctx, ZMQ_PAIR);
|
||||||
void *socket = zmq_socket(ctx, ZMQ_PAIR);
|
|
||||||
if (!socket)
|
if (!socket)
|
||||||
break;
|
break;
|
||||||
|
sockets.push_back (socket);
|
||||||
|
}
|
||||||
|
// We may stop sooner if system has fewer available sockets
|
||||||
|
assert (sockets.size () <= ZMQ_MAX_SOCKETS_DFLT);
|
||||||
|
|
||||||
sockets.push_back(socket);
|
// Further calls to zmq_socket should return NULL
|
||||||
|
for (unsigned int i = 0; i < 10; ++i) {
|
||||||
|
void *socket = zmq_socket (ctx, ZMQ_PAIR);
|
||||||
|
assert (socket == NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(sockets.size() == ZMQ_MAX_SOCKETS_DFLT);
|
// Clean up
|
||||||
|
for (unsigned int i = 0; i < sockets.size (); ++i)
|
||||||
|
zmq_close (sockets [i]);
|
||||||
|
|
||||||
// At zeromq max, further calls to zmq_socket should return NULL.
|
zmq_ctx_destroy (ctx);
|
||||||
for (unsigned int i = 0; i < 10; ++i)
|
|
||||||
{
|
|
||||||
void *socket = zmq_socket(ctx, ZMQ_PAIR);
|
|
||||||
assert(socket == NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clean up.
|
|
||||||
for (unsigned int i = 0; i < sockets.size(); ++i)
|
|
||||||
zmq_close(sockets[i]);
|
|
||||||
|
|
||||||
zmq_ctx_destroy(ctx);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void)
|
int main (void)
|
||||||
{
|
{
|
||||||
setup_test_environment();
|
setup_test_environment ();
|
||||||
|
|
||||||
test_system_max ();
|
test_system_max ();
|
||||||
test_zmq_default_max ();
|
test_zmq_default_max ();
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#include "../include/zmq.h"
|
#include "../include/zmq.h"
|
||||||
#include "../include/zmq_utils.h"
|
#include "../include/zmq_utils.h"
|
||||||
#include "platform.hpp"
|
#include "../src/platform.hpp"
|
||||||
|
|
||||||
// This defines the settle time used in tests; raise this if we
|
// This defines the settle time used in tests; raise this if we
|
||||||
// get test failures on slower systems due to binds/connects not
|
// get test failures on slower systems due to binds/connects not
|
||||||
|
Loading…
x
Reference in New Issue
Block a user