Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
beffee92
Commit
beffee92
authored
Apr 26, 2010
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
P2P renamed to PAIR
parent
7d9603d7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
31 deletions
+33
-31
zmq_socket.txt
doc/zmq_socket.txt
+4
-4
zmq.h
include/zmq.h
+3
-1
Makefile.am
src/Makefile.am
+2
-2
app_thread.cpp
src/app_thread.cpp
+3
-3
pair.cpp
src/pair.cpp
+14
-14
pair.hpp
src/pair.hpp
+7
-7
No files found.
doc/zmq_socket.txt
View file @
beffee92
...
...
@@ -26,12 +26,12 @@ Peer to peer pattern
~~~~~~~~~~~~~~~~~~~~
The simplest messaging pattern, used for communicating between two peers.
Socket type:: 'ZMQ_P
2P
'
Compatible peer sockets:: 'ZMQ_P
2P
'
Socket type:: 'ZMQ_P
AIR
'
Compatible peer sockets:: 'ZMQ_P
AIR
'
A socket of type 'ZMQ_P
2P
' can only be connected to a single peer at any one
A socket of type 'ZMQ_P
AIR
' 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_P
2P
' socket.
'ZMQ_P
AIR
' socket.
Publish-subscribe pattern
...
...
include/zmq.h
View file @
beffee92
...
...
@@ -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
...
...
src/Makefile.am
View file @
beffee92
...
...
@@ -90,7 +90,7 @@ libzmq_la_SOURCES = app_thread.hpp \
platform.hpp
\
poll.hpp
\
poller.hpp
\
p
2p
.hpp
\
p
air
.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
\
p
2p
.cpp
\
p
air
.cpp
\
prefix_tree.cpp
\
pipe.cpp
\
poll.cpp
\
...
...
src/app_thread.cpp
View file @
beffee92
...
...
@@ -41,7 +41,7 @@
#include "pipe.hpp"
#include "config.hpp"
#include "socket_base.hpp"
#include "p
2p
.hpp"
#include "p
air
.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_P
2P
:
s
=
new
(
std
::
nothrow
)
p
2p
_t
(
this
);
case
ZMQ_P
AIR
:
s
=
new
(
std
::
nothrow
)
p
air
_t
(
this
);
break
;
case
ZMQ_PUB
:
s
=
new
(
std
::
nothrow
)
pub_t
(
this
);
...
...
src/p
2p
.cpp
→
src/p
air
.cpp
View file @
beffee92
...
...
@@ -19,11 +19,11 @@
#include "../include/zmq.h"
#include "p
2p
.hpp"
#include "p
air
.hpp"
#include "err.hpp"
#include "pipe.hpp"
zmq
::
p
2p_t
::
p2p
_t
(
class
app_thread_t
*
parent_
)
:
zmq
::
p
air_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
::
p
2p_t
::~
p2p
_t
()
zmq
::
p
air_t
::~
pair
_t
()
{
if
(
inpipe
)
inpipe
->
term
();
...
...
@@ -41,7 +41,7 @@ zmq::p2p_t::~p2p_t ()
outpipe
->
term
();
}
void
zmq
::
p
2p
_t
::
xattach_pipes
(
class
reader_t
*
inpipe_
,
void
zmq
::
p
air
_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
::
p
2p
_t
::
xdetach_inpipe
(
class
reader_t
*
pipe_
)
void
zmq
::
p
air
_t
::
xdetach_inpipe
(
class
reader_t
*
pipe_
)
{
zmq_assert
(
pipe_
==
inpipe
);
inpipe
=
NULL
;
}
void
zmq
::
p
2p
_t
::
xdetach_outpipe
(
class
writer_t
*
pipe_
)
void
zmq
::
p
air
_t
::
xdetach_outpipe
(
class
writer_t
*
pipe_
)
{
zmq_assert
(
pipe_
==
outpipe
);
outpipe
=
NULL
;
}
void
zmq
::
p
2p
_t
::
xkill
(
class
reader_t
*
pipe_
)
void
zmq
::
p
air
_t
::
xkill
(
class
reader_t
*
pipe_
)
{
zmq_assert
(
alive
);
alive
=
false
;
}
void
zmq
::
p
2p
_t
::
xrevive
(
class
reader_t
*
pipe_
)
void
zmq
::
p
air
_t
::
xrevive
(
class
reader_t
*
pipe_
)
{
zmq_assert
(
!
alive
);
alive
=
true
;
}
void
zmq
::
p
2p
_t
::
xrevive
(
class
writer_t
*
pipe_
)
void
zmq
::
p
air
_t
::
xrevive
(
class
writer_t
*
pipe_
)
{
zmq_assert
(
!
outpipe_alive
);
outpipe_alive
=
true
;
}
int
zmq
::
p
2p
_t
::
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
int
zmq
::
p
air
_t
::
xsetsockopt
(
int
option_
,
const
void
*
optval_
,
size_t
optvallen_
)
{
errno
=
EINVAL
;
return
-
1
;
}
int
zmq
::
p
2p
_t
::
xsend
(
zmq_msg_t
*
msg_
,
int
flags_
)
int
zmq
::
p
air
_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
::
p
2p
_t
::
xrecv
(
zmq_msg_t
*
msg_
,
int
flags_
)
int
zmq
::
p
air
_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
::
p
2p
_t
::
xhas_in
()
bool
zmq
::
p
air
_t
::
xhas_in
()
{
if
(
alive
&&
inpipe
&&
inpipe
->
check_read
())
return
true
;
return
false
;
}
bool
zmq
::
p
2p
_t
::
xhas_out
()
bool
zmq
::
p
air
_t
::
xhas_out
()
{
if
(
outpipe
==
NULL
||
!
outpipe_alive
)
return
false
;
...
...
src/p
2p
.hpp
→
src/p
air
.hpp
View file @
beffee92
...
...
@@ -17,20 +17,20 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ZMQ_P
2P
_HPP_INCLUDED__
#define __ZMQ_P
2P
_HPP_INCLUDED__
#ifndef __ZMQ_P
AIR
_HPP_INCLUDED__
#define __ZMQ_P
AIR
_HPP_INCLUDED__
#include "socket_base.hpp"
namespace
zmq
{
class
p
2p
_t
:
public
socket_base_t
class
p
air
_t
:
public
socket_base_t
{
public
:
p
2p
_t
(
class
app_thread_t
*
parent_
);
~
p
2p
_t
();
p
air
_t
(
class
app_thread_t
*
parent_
);
~
p
air
_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
;
p
2p_t
(
const
p2p
_t
&
);
void
operator
=
(
const
p
2p
_t
&
);
p
air_t
(
const
pair
_t
&
);
void
operator
=
(
const
p
air
_t
&
);
};
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment