From d9f33bb09f3b13eab3839a660c0112d6033481a3 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 3 Jul 2015 17:46:10 +0200 Subject: Allow empty component labels --- src/ConfigParser.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index 8c5cbaa..443e26d 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -415,15 +415,17 @@ void parse_ptree(boost::property_tree::ptree& pt, component->type = component_type; int success = -5; - string componentlabel = pt_comp.get("label"); + string componentlabel = pt_comp.get("label", ""); string componentshortlabel(componentlabel); try { componentshortlabel = pt_comp.get("shortlabel"); success = component->label.setLabel(componentlabel, componentshortlabel); } catch (ptree_error &e) { - etiLog.level(warn) << "Component short label undefined, " - "truncating label " << componentlabel; + if (not componentlabel.empty()) { + etiLog.level(warn) << "Component short label undefined, " + "truncating label " << componentlabel; + } success = component->label.setLabel(componentlabel); } -- cgit v1.2.3 From 51ca1a636957a947b04729a7d3a5fe33abba6b8a Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 3 Jul 2015 08:04:36 +0200 Subject: update zmq.hpp to support zmq 4.1.x --- src/zmq.hpp | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/zmq.hpp b/src/zmq.hpp index 147f096..eb5416e 100644 --- a/src/zmq.hpp +++ b/src/zmq.hpp @@ -60,6 +60,15 @@ #define ZMQ_NEW_MONITOR_EVENT_LAYOUT #endif +#if ZMQ_VERSION >= ZMQ_MAKE_VERSION(4, 1, 0) +#define ZMQ_HAS_PROXY_STEERABLE +/* Socket event data */ +typedef struct { + uint16_t event; // id of the event as bitfield + int32_t value ; // value is either error code, fd or reconnect interval +} zmq_event_t; +#endif + // In order to prevent unused variable warnings when building in non-debug // mode use this macro to make assertions. #ifndef NDEBUG @@ -109,7 +118,16 @@ namespace zmq if (rc != 0) throw error_t (); } - + +#ifdef ZMQ_HAS_PROXY_STEERABLE + inline void proxy_steerable (void *frontend, void *backend, void *capture, void *control) + { + int rc = zmq_proxy_steerable (frontend, backend, capture, control); + if (rc != 0) + throw error_t (); + } +#endif + inline void version (int *major_, int *minor_, int *patch_) { zmq_version (major_, minor_, patch_); @@ -254,7 +272,7 @@ namespace zmq } - inline explicit context_t (int io_threads_) + inline explicit context_t (int io_threads_, int max_sockets_ = ZMQ_MAX_SOCKETS_DFLT) { ptr = zmq_ctx_new (); if (ptr == NULL) @@ -262,6 +280,9 @@ namespace zmq int rc = zmq_ctx_set (ptr, ZMQ_IO_THREADS, io_threads_); ZMQ_ASSERT (rc == 0); + + rc = zmq_ctx_set (ptr, ZMQ_MAX_SOCKETS, max_sockets_); + ZMQ_ASSERT (rc == 0); } #ifdef ZMQ_HAS_RVALUE_REFS @@ -420,6 +441,13 @@ namespace zmq throw error_t (); } +#ifdef ZMQ_HAS_RVALUE_REFS + inline bool send (message_t &&msg_, int flags_ = 0) + { + return send(msg_, flags_); + } +#endif + inline size_t recv (void *buf_, size_t len_, int flags_ = 0) { int nbytes = zmq_recv (ptr, buf_, len_, flags_); @@ -476,7 +504,15 @@ namespace zmq if (rc == -1 && zmq_errno() == ETERM) break; assert (rc != -1); - zmq_event_t* event = static_cast(zmq_msg_data (&eventMsg)); +#if ZMQ_VERSION_MAJOR >= 4 + const char* data = static_cast(zmq_msg_data(&eventMsg)); + zmq_event_t msgEvent; + memcpy(&msgEvent.event, data, sizeof(uint16_t)); data += sizeof(uint16_t); + memcpy(&msgEvent.value, data, sizeof(int32_t)); + zmq_event_t* event = &msgEvent; +#else + zmq_event_t* event = static_cast(zmq_msg_data(&eventMsg)); +#endif #ifdef ZMQ_NEW_MONITOR_EVENT_LAYOUT zmq_msg_t addrMsg; -- cgit v1.2.3