Update to 4.1.4 (#1292814) and refresh zmq.hpp

epel9
Thomas Spura 9 years ago
parent 729573e58e
commit eb3bd66bd0

1
.gitignore vendored

@ -9,3 +9,4 @@ zeromq-2.0.7.tar.gz
/zeromq-4.0.5.tar.gz
/zeromq-4.1.2.tar.gz
/zeromq-4.1.3.tar.gz
/zeromq-4.1.4.tar.gz

@ -1 +1 @@
d0824317348cfb44b8692e19cc73dc3a zeromq-4.1.3.tar.gz
a611ecc93fffeb6d058c0e6edf4ad4fb zeromq-4.1.4.tar.gz

@ -1,7 +1,7 @@
%bcond_without pgm
Name: zeromq
Version: 4.1.3
Version: 4.1.4
Release: 1%{?dist}
Summary: Software library for fast, message-based applications
@ -128,6 +128,10 @@ make check V=1
%changelog
* Sat Dec 19 2015 Thomas Spura <tomspur@fedoraproject.org> - 4.1.4-1
- update to 4.1.4 (#1292814)
- refresh zmq.hpp
* Mon Aug 24 2015 Thomas Spura <tomspur@fedoraproject.org> - 4.1.3-1
- update to 4.1.3 (#1256209)
- ipv6 patch included upstream

@ -86,6 +86,12 @@ typedef struct {
} zmq_event_t;
#endif
// Avoid using deprecated message receive function when possible
#if ZMQ_VERSION < ZMQ_MAKE_VERSION(3, 2, 0)
# define zmq_msg_recv(msg, socket, flags) zmq_recvmsg(socket, msg, flags)
#endif
// In order to prevent unused variable warnings when building in non-debug
// mode use this macro to make assertions.
#ifndef NDEBUG
@ -121,9 +127,9 @@ namespace zmq
int errnum;
};
inline int poll (zmq_pollitem_t const* items_, int nitems_, long timeout_ = -1)
inline int poll (zmq_pollitem_t const* items_, size_t nitems_, long timeout_ = -1)
{
int rc = zmq_poll (const_cast<zmq_pollitem_t*>(items_), nitems_, timeout_);
int rc = zmq_poll (const_cast<zmq_pollitem_t*>(items_), static_cast<int>(nitems_), timeout_);
if (rc < 0)
throw error_t ();
return rc;
@ -131,7 +137,7 @@ namespace zmq
inline int poll(zmq_pollitem_t const* items, size_t nitems)
{
return poll(items, nitems, -1 );
return poll(items, nitems, -1);
}
#ifdef ZMQ_CPP11
@ -144,12 +150,12 @@ namespace zmq
{
return poll(items.data(), items.size(), timeout.count() );
}
#endif
inline int poll(std::vector<zmq_pollitem_t> const& items, long timeout_ = -1)
{
return poll(items.data(), items.size(), timeout_);
}
#endif
@ -207,13 +213,26 @@ namespace zmq
msg()
{
typedef typename std::iterator_traits<I>::difference_type size_type;
typedef typename std::iterator_traits<I>::pointer pointer_t;
typedef typename std::iterator_traits<I>::value_type value_t;
size_type const size_ = std::distance(first, last);
size_type const size_ = std::distance(first, last)*sizeof(value_t);
int const rc = zmq_msg_init_size (&msg, size_);
if (rc != 0)
throw error_t ();
std::copy(first, last, static_cast<pointer_t>(zmq_msg_data (&msg)) );
value_t* dest = data<value_t>();
while (first != last)
{
*dest = *first;
++dest; ++first;
}
}
inline message_t (const void *data_, size_t size_)
{
int rc = zmq_msg_init_size (&msg, size_);
if (rc != 0)
throw error_t ();
memcpy(data(), data_, size_);
}
inline message_t (void *data_, size_t size_, free_fn *ffn_,
@ -265,6 +284,17 @@ namespace zmq
throw error_t ();
}
inline void rebuild (const void *data_, size_t size_)
{
int rc = zmq_msg_close (&msg);
if (rc != 0)
throw error_t ();
rc = zmq_msg_init_size (&msg, size_);
if (rc != 0)
throw error_t ();
memcpy(data(), data_, size_);
}
inline void rebuild (void *data_, size_t size_, free_fn *ffn_,
void *hint_ = NULL)
{
@ -372,16 +402,14 @@ namespace zmq
inline ~context_t () ZMQ_NOTHROW
{
close();
int rc = zmq_ctx_destroy (ptr);
ZMQ_ASSERT (rc == 0);
}
inline void close() ZMQ_NOTHROW
{
if (ptr == NULL)
return;
int rc = zmq_ctx_destroy (ptr);
int rc = zmq_ctx_shutdown (ptr);
ZMQ_ASSERT (rc == 0);
ptr = NULL;
}
// Be careful with this, it's probably only useful for
@ -417,8 +445,12 @@ namespace zmq
xsub = ZMQ_XSUB,
push = ZMQ_PUSH,
pull = ZMQ_PULL,
#if ZMQ_VERSION_MAJOR < 4
pair = ZMQ_PAIR
#else
pair = ZMQ_PAIR,
stream = ZMQ_STREAM
#endif
};
#endif
@ -489,14 +521,14 @@ namespace zmq
}
inline void getsockopt (int option_, void *optval_,
size_t *optvallen_)
size_t *optvallen_) const
{
int rc = zmq_getsockopt (ptr, option_, optval_, optvallen_);
if (rc != 0)
throw error_t ();
}
template<typename T> T getsockopt(int option_)
template<typename T> T getsockopt(int option_) const
{
T optval;
size_t optlen = sizeof(T);
@ -655,7 +687,7 @@ namespace zmq
while (true) {
zmq_msg_t eventMsg;
zmq_msg_init (&eventMsg);
rc = zmq_recvmsg (s, &eventMsg, 0);
rc = zmq_msg_recv (&eventMsg, s, 0);
if (rc == -1 && zmq_errno() == ETERM)
break;
assert (rc != -1);
@ -672,7 +704,7 @@ namespace zmq
#ifdef ZMQ_NEW_MONITOR_EVENT_LAYOUT
zmq_msg_t addrMsg;
zmq_msg_init (&addrMsg);
rc = zmq_recvmsg (s, &addrMsg, 0);
rc = zmq_msg_recv (&addrMsg, s, 0);
if (rc == -1 && zmq_errno() == ETERM)
break;
assert (rc != -1);

Loading…
Cancel
Save