diff options
-rw-r--r-- | builds/redhat/zeromq.spec | 7 | ||||
-rw-r--r-- | include/zmq.h | 10 | ||||
-rw-r--r-- | include/zmq.hpp | 7 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/device.cpp | 120 | ||||
-rw-r--r-- | src/device.hpp | 32 | ||||
-rw-r--r-- | src/zmq.cpp | 18 |
7 files changed, 0 insertions, 196 deletions
diff --git a/builds/redhat/zeromq.spec b/builds/redhat/zeromq.spec index e3177b4..f09f12d 100644 --- a/builds/redhat/zeromq.spec +++ b/builds/redhat/zeromq.spec @@ -91,14 +91,7 @@ This package contains ZeroMQ related development libraries and header files. %{_libdir}/libzmq.so.1 %{_libdir}/libzmq.so.1.0.0 -%attr(0755,root,root) %{_bindir}/zmq_forwarder -%attr(0755,root,root) %{_bindir}/zmq_queue -%attr(0755,root,root) %{_bindir}/zmq_streamer - %{_mandir}/man7/zmq.7.gz -%{_mandir}/man1/zmq_forwarder.1.gz -%{_mandir}/man1/zmq_queue.1.gz -%{_mandir}/man1/zmq_streamer.1.gz %files devel %defattr(-,root,root,-) diff --git a/include/zmq.h b/include/zmq.h index e0e5653..6f8e766 100644 --- a/include/zmq.h +++ b/include/zmq.h @@ -241,16 +241,6 @@ typedef struct ZMQ_EXPORT int zmq_poll (zmq_pollitem_t *items, int nitems, long timeout); -/******************************************************************************/ -/* Devices - Experimental. */ -/******************************************************************************/ - -#define ZMQ_STREAMER 1 -#define ZMQ_FORWARDER 2 -#define ZMQ_QUEUE 3 - -ZMQ_EXPORT int zmq_device (int device, void * insocket, void* outsocket); - #undef ZMQ_EXPORT #ifdef __cplusplus diff --git a/include/zmq.hpp b/include/zmq.hpp index 813535f..2189e81 100644 --- a/include/zmq.hpp +++ b/include/zmq.hpp @@ -62,13 +62,6 @@ namespace zmq return rc; } - inline void device (int device_, void * insocket_, void* outsocket_) - { - int rc = zmq_device (device_, insocket_, outsocket_); - if (rc != 0) - throw error_t (); - } - class message_t : private zmq_msg_t { friend class socket_t; diff --git a/src/Makefile.am b/src/Makefile.am index b730f38..f8d957f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -71,7 +71,6 @@ libzmq_la_SOURCES = \ connect_session.hpp \ ctx.hpp \ decoder.hpp \ - device.hpp \ devpoll.hpp \ dist.hpp \ encoder.hpp \ @@ -141,7 +140,6 @@ libzmq_la_SOURCES = \ ctx.cpp \ connect_session.cpp \ decoder.cpp \ - device.cpp \ devpoll.cpp \ dist.cpp \ encoder.cpp \ diff --git a/src/device.cpp b/src/device.cpp deleted file mode 100644 index 351283a..0000000 --- a/src/device.cpp +++ /dev/null @@ -1,120 +0,0 @@ -/* - Copyright (c) 2007-2011 iMatix Corporation - Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file - - This file is part of 0MQ. - - 0MQ is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - 0MQ is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#include <stddef.h> - -#include "../include/zmq.h" - -#include "device.hpp" -#include "socket_base.hpp" -#include "likely.hpp" -#include "err.hpp" - -int zmq::device (class socket_base_t *insocket_, - class socket_base_t *outsocket_) -{ - zmq_msg_t msg; - int rc = zmq_msg_init (&msg); - - if (rc != 0) { - return -1; - } - - int64_t more; - size_t moresz; - - zmq_pollitem_t items [2]; - items [0].socket = insocket_; - items [0].fd = 0; - items [0].events = ZMQ_POLLIN; - items [0].revents = 0; - items [1].socket = outsocket_; - items [1].fd = 0; - items [1].events = ZMQ_POLLIN; - items [1].revents = 0; - - while (true) { - - // Wait while there are either requests or replies to process. - rc = zmq_poll (&items [0], 2, -1); - if (unlikely (rc < 0)) { - return -1; - } - - // The algorithm below asumes ratio of request and replies processed - // under full load to be 1:1. Although processing requests replies - // first is tempting it is suspectible to DoS attacks (overloading - // the system with unsolicited replies). - - // Process a request. - if (items [0].revents & ZMQ_POLLIN) { - while (true) { - - rc = insocket_->recv (&msg, 0); - if (unlikely (rc < 0)) { - return -1; - } - - moresz = sizeof (more); - rc = insocket_->getsockopt (ZMQ_RCVMORE, &more, &moresz); - if (unlikely (rc < 0)) { - return -1; - } - - rc = outsocket_->send (&msg, more ? ZMQ_SNDMORE : 0); - if (unlikely (rc < 0)) { - return -1; - } - - if (!more) - break; - } - } - - // Process a reply. - if (items [1].revents & ZMQ_POLLIN) { - while (true) { - - rc = outsocket_->recv (&msg, 0); - if (unlikely (rc < 0)) { - return -1; - } - - moresz = sizeof (more); - rc = outsocket_->getsockopt (ZMQ_RCVMORE, &more, &moresz); - if (unlikely (rc < 0)) { - return -1; - } - - rc = insocket_->send (&msg, more ? ZMQ_SNDMORE : 0); - if (unlikely (rc < 0)) { - return -1; - } - - if (!more) - break; - } - } - - } - - return 0; -} - diff --git a/src/device.hpp b/src/device.hpp deleted file mode 100644 index c5b7118..0000000 --- a/src/device.hpp +++ /dev/null @@ -1,32 +0,0 @@ -/* - Copyright (c) 2007-2011 iMatix Corporation - Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file - - This file is part of 0MQ. - - 0MQ is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - 0MQ is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see <http://www.gnu.org/licenses/>. -*/ - -#ifndef __ZMQ_DEVICE_HPP_INCLUDED__ -#define __ZMQ_DEVICE_HPP_INCLUDED__ - -namespace zmq -{ - - int device (class socket_base_t *insocket_, - class socket_base_t *outsocket_); - -} - -#endif diff --git a/src/zmq.cpp b/src/zmq.cpp index 5029734..89848e7 100644 --- a/src/zmq.cpp +++ b/src/zmq.cpp @@ -40,7 +40,6 @@ #include <stdlib.h> #include <new> -#include "device.hpp" #include "socket_base.hpp" #include "msg_content.hpp" #include "stdint.hpp" @@ -729,23 +728,6 @@ int zmq_errno () return errno; } -int zmq_device (int device_, void *insocket_, void *outsocket_) -{ - if (!insocket_ || !outsocket_) { - errno = EFAULT; - return -1; - } - - if (device_ != ZMQ_FORWARDER && device_ != ZMQ_QUEUE && - device_ != ZMQ_STREAMER) { - errno = EINVAL; - return -1; - } - - return zmq::device ((zmq::socket_base_t*) insocket_, - (zmq::socket_base_t*) outsocket_); -} - //////////////////////////////////////////////////////////////////////////////// // 0MQ utils - to be used by perf tests //////////////////////////////////////////////////////////////////////////////// |