summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-04-26 16:51:05 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-04-26 16:51:05 +0200
commitbeffee92a8ec9e14cca21e5901970c4d03967c3d (patch)
tree871f2db9d9fba2d5af62f5f4d514b215b921676b
parent7d9603d722c9c2752dccd0c51f470e68d0e0c48c (diff)
P2P renamed to PAIR
-rw-r--r--doc/zmq_socket.txt8
-rw-r--r--include/zmq.h4
-rw-r--r--src/Makefile.am4
-rw-r--r--src/app_thread.cpp6
-rw-r--r--src/pair.cpp (renamed from src/p2p.cpp)28
-rw-r--r--src/pair.hpp (renamed from src/p2p.hpp)14
6 files changed, 33 insertions, 31 deletions
diff --git a/doc/zmq_socket.txt b/doc/zmq_socket.txt
index 8f10cc7..7784c71 100644
--- a/doc/zmq_socket.txt
+++ b/doc/zmq_socket.txt
@@ -26,12 +26,12 @@ Peer to peer pattern
~~~~~~~~~~~~~~~~~~~~
The simplest messaging pattern, used for communicating between two peers.
-Socket type:: 'ZMQ_P2P'
-Compatible peer sockets:: 'ZMQ_P2P'
+Socket type:: 'ZMQ_PAIR'
+Compatible peer sockets:: 'ZMQ_PAIR'
-A socket of type 'ZMQ_P2P' can only be connected to a single peer at any one
+A socket of type 'ZMQ_PAIR' can only be connected to a single peer at any one
time. No message routing or filtering is performed on messages sent over a
-'ZMQ_P2P' socket.
+'ZMQ_PAIR' socket.
Publish-subscribe pattern
diff --git a/include/zmq.h b/include/zmq.h
index a7638aa..e860146 100644
--- a/include/zmq.h
+++ b/include/zmq.h
@@ -153,7 +153,9 @@ ZMQ_EXPORT int zmq_term (void *context);
/* 0MQ socket definition. */
/******************************************************************************/
-/* Socket types. */
+/* Socket types. */
+/* ZMQ_P2P is obsolete and scheduled to be removed in version 2.0.8 */
+#define ZMQ_PAIR 0
#define ZMQ_P2P 0
#define ZMQ_PUB 1
#define ZMQ_SUB 2
diff --git a/src/Makefile.am b/src/Makefile.am
index 8277794..8cd94dd 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -90,7 +90,7 @@ libzmq_la_SOURCES = app_thread.hpp \
platform.hpp \
poll.hpp \
poller.hpp \
- p2p.hpp \
+ pair.hpp \
prefix_tree.hpp \
pub.hpp \
queue.hpp \
@@ -145,7 +145,7 @@ libzmq_la_SOURCES = app_thread.hpp \
pgm_receiver.cpp \
pgm_sender.cpp \
pgm_socket.cpp \
- p2p.cpp \
+ pair.cpp \
prefix_tree.cpp \
pipe.cpp \
poll.cpp \
diff --git a/src/app_thread.cpp b/src/app_thread.cpp
index 6141c06..9ff2112 100644
--- a/src/app_thread.cpp
+++ b/src/app_thread.cpp
@@ -41,7 +41,7 @@
#include "pipe.hpp"
#include "config.hpp"
#include "socket_base.hpp"
-#include "p2p.hpp"
+#include "pair.hpp"
#include "pub.hpp"
#include "sub.hpp"
#include "req.hpp"
@@ -152,8 +152,8 @@ zmq::socket_base_t *zmq::app_thread_t::create_socket (int type_)
{
socket_base_t *s = NULL;
switch (type_) {
- case ZMQ_P2P:
- s = new (std::nothrow) p2p_t (this);
+ case ZMQ_PAIR:
+ s = new (std::nothrow) pair_t (this);
break;
case ZMQ_PUB:
s = new (std::nothrow) pub_t (this);
diff --git a/src/p2p.cpp b/src/pair.cpp
index 3f63d81..31524de 100644
--- a/src/p2p.cpp
+++ b/src/pair.cpp
@@ -19,11 +19,11 @@
#include "../include/zmq.h"
-#include "p2p.hpp"
+#include "pair.hpp"
#include "err.hpp"
#include "pipe.hpp"
-zmq::p2p_t::p2p_t (class app_thread_t *parent_) :
+zmq::pair_t::pair_t (class app_thread_t *parent_) :
socket_base_t (parent_),
inpipe (NULL),
outpipe (NULL),
@@ -33,7 +33,7 @@ zmq::p2p_t::p2p_t (class app_thread_t *parent_) :
options.requires_out = true;
}
-zmq::p2p_t::~p2p_t ()
+zmq::pair_t::~pair_t ()
{
if (inpipe)
inpipe->term ();
@@ -41,7 +41,7 @@ zmq::p2p_t::~p2p_t ()
outpipe->term ();
}
-void zmq::p2p_t::xattach_pipes (class reader_t *inpipe_,
+void zmq::pair_t::xattach_pipes (class reader_t *inpipe_,
class writer_t *outpipe_, const blob_t &peer_identity_)
{
zmq_assert (!inpipe && !outpipe);
@@ -50,44 +50,44 @@ void zmq::p2p_t::xattach_pipes (class reader_t *inpipe_,
outpipe_alive = true;
}
-void zmq::p2p_t::xdetach_inpipe (class reader_t *pipe_)
+void zmq::pair_t::xdetach_inpipe (class reader_t *pipe_)
{
zmq_assert (pipe_ == inpipe);
inpipe = NULL;
}
-void zmq::p2p_t::xdetach_outpipe (class writer_t *pipe_)
+void zmq::pair_t::xdetach_outpipe (class writer_t *pipe_)
{
zmq_assert (pipe_ == outpipe);
outpipe = NULL;
}
-void zmq::p2p_t::xkill (class reader_t *pipe_)
+void zmq::pair_t::xkill (class reader_t *pipe_)
{
zmq_assert (alive);
alive = false;
}
-void zmq::p2p_t::xrevive (class reader_t *pipe_)
+void zmq::pair_t::xrevive (class reader_t *pipe_)
{
zmq_assert (!alive);
alive = true;
}
-void zmq::p2p_t::xrevive (class writer_t *pipe_)
+void zmq::pair_t::xrevive (class writer_t *pipe_)
{
zmq_assert (!outpipe_alive);
outpipe_alive = true;
}
-int zmq::p2p_t::xsetsockopt (int option_, const void *optval_,
+int zmq::pair_t::xsetsockopt (int option_, const void *optval_,
size_t optvallen_)
{
errno = EINVAL;
return -1;
}
-int zmq::p2p_t::xsend (zmq_msg_t *msg_, int flags_)
+int zmq::pair_t::xsend (zmq_msg_t *msg_, int flags_)
{
if (outpipe == NULL || !outpipe_alive) {
errno = EAGAIN;
@@ -109,7 +109,7 @@ int zmq::p2p_t::xsend (zmq_msg_t *msg_, int flags_)
return 0;
}
-int zmq::p2p_t::xrecv (zmq_msg_t *msg_, int flags_)
+int zmq::pair_t::xrecv (zmq_msg_t *msg_, int flags_)
{
// Deallocate old content of the message.
zmq_msg_close (msg_);
@@ -121,14 +121,14 @@ int zmq::p2p_t::xrecv (zmq_msg_t *msg_, int flags_)
return 0;
}
-bool zmq::p2p_t::xhas_in ()
+bool zmq::pair_t::xhas_in ()
{
if (alive && inpipe && inpipe->check_read ())
return true;
return false;
}
-bool zmq::p2p_t::xhas_out ()
+bool zmq::pair_t::xhas_out ()
{
if (outpipe == NULL || !outpipe_alive)
return false;
diff --git a/src/p2p.hpp b/src/pair.hpp
index 57320d9..aea249f 100644
--- a/src/p2p.hpp
+++ b/src/pair.hpp
@@ -17,20 +17,20 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ZMQ_P2P_HPP_INCLUDED__
-#define __ZMQ_P2P_HPP_INCLUDED__
+#ifndef __ZMQ_PAIR_HPP_INCLUDED__
+#define __ZMQ_PAIR_HPP_INCLUDED__
#include "socket_base.hpp"
namespace zmq
{
- class p2p_t : public socket_base_t
+ class pair_t : public socket_base_t
{
public:
- p2p_t (class app_thread_t *parent_);
- ~p2p_t ();
+ pair_t (class app_thread_t *parent_);
+ ~pair_t ();
// Overloads of functions from socket_base_t.
void xattach_pipes (class reader_t *inpipe_, class writer_t *outpipe_,
@@ -54,8 +54,8 @@ namespace zmq
bool alive;
bool outpipe_alive;
- p2p_t (const p2p_t&);
- void operator = (const p2p_t&);
+ pair_t (const pair_t&);
+ void operator = (const pair_t&);
};
}