Skip to content

Instantly share code, notes, and snippets.

View sustrik's full-sized avatar

Martin Sustrik sustrik

View GitHub Profile
#include <stdint.h>
#include <unistd.h>
#include <zmq.hpp>
int main ()
{
zmq::context_t ctx (1);
zmq::socket_t s (ctx, ZMQ_XREP);
const int64_t hwm = 1;
diff --git a/src/xrep.cpp b/src/xrep.cpp
index 422b0c0..84d193c 100644
--- a/src/xrep.cpp
+++ b/src/xrep.cpp
@@ -177,8 +177,21 @@ int zmq::xrep_t::xsend (zmq_msg_t *msg_, int flags_)
blob_t identity ((unsigned char*) zmq_msg_data (msg_),
zmq_msg_size (msg_));
outpipes_t::iterator it = outpipes.find (identity);
- if (it != outpipes.end ())
+ if (it != outpipes.end ()) {
#include <zmq.hpp>
#include <unistd.h>
int main ()
{
zmq::context_t ctx (1);
zmq::socket_t s1 (ctx, ZMQ_XREP);
s1.setsockopt (ZMQ_IDENTITY, "A", 1);
s1.bind ("tcp://lo:5555");
#include <pthread.h>
#include <unistd.h>
#include <zmq.hpp>
void *client (void*)
{
zmq::context_t ctx (1);
for (int i = 0; i != 8000; i++)
{
diff --git a/src/config.hpp b/src/config.hpp
index f144512..85a6b0a 100644
--- a/src/config.hpp
+++ b/src/config.hpp
@@ -29,7 +29,7 @@ namespace zmq
enum
{
// Maximum number of sockets that can be opened at the same time.
- max_sockets = 512,
+ max_sockets = 40000,
diff --git a/src/config.hpp b/src/config.hpp
index f144512..85a6b0a 100644
--- a/src/config.hpp
+++ b/src/config.hpp
@@ -29,7 +29,7 @@ namespace zmq
enum
{
// Maximum number of sockets that can be opened at the same time.
- max_sockets = 512,
+ max_sockets = 40000,
diff --git a/src/dist.cpp b/src/dist.cpp
index dd2166a..e447bc1 100644
--- a/src/dist.cpp
+++ b/src/dist.cpp
@@ -41,6 +41,13 @@ zmq::dist_t::~dist_t ()
void zmq::dist_t::attach (writer_t *pipe_)
{
+ // If we are in the middle of sending a message, let's postpone plugging
+ // in the pipe.
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <zmq.hpp>
int main ()
{
zmq::context_t ctx (1);
#include "zmq.h"
#include "assert.h"
#include "stdint.h"
#include "string.h"
int main ()
{
void *ctx = zmq_init (1);
assert (ctx);
#include "zmq.h"
#include "assert.h"
#include "stdint.h"
int main ()
{
void *ctx = zmq_init (1);
assert (ctx);
void *s = zmq_socket (ctx, ZMQ_SUB);