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
72a793f7
Commit
72a793f7
authored
Jul 21, 2011
by
Martin Sustrik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZMQ_GENERIC renamed to ZMQ_ROUTER
Signed-off-by:
Martin Sustrik
<
sustrik@250bpm.com
>
parent
cb2d7156
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
27 deletions
+26
-27
zmq.h
include/zmq.h
+1
-1
Makefile.am
src/Makefile.am
+2
-2
router.cpp
src/router.cpp
+13
-13
router.hpp
src/router.hpp
+7
-8
socket_base.cpp
src/socket_base.cpp
+3
-3
No files found.
include/zmq.h
View file @
72a793f7
...
...
@@ -158,7 +158,7 @@ ZMQ_EXPORT int zmq_term (void *context);
#define ZMQ_PUSH 8
#define ZMQ_XPUB 9
#define ZMQ_XSUB 10
#define ZMQ_
GENERIC
13
#define ZMQ_
ROUTER
13
/* Socket options. */
#define ZMQ_AFFINITY 4
...
...
src/Makefile.am
View file @
72a793f7
...
...
@@ -23,7 +23,6 @@ libzmq_la_SOURCES = \
err.hpp
\
fd.hpp
\
fq.hpp
\
generic.hpp
\
io_object.hpp
\
io_thread.hpp
\
ip.hpp
\
...
...
@@ -55,6 +54,7 @@ libzmq_la_SOURCES = \
reaper.hpp
\
rep.hpp
\
req.hpp
\
router.hpp
\
select
.hpp
\
semaphore.hpp
\
session.hpp
\
...
...
@@ -89,7 +89,6 @@ libzmq_la_SOURCES = \
epoll.cpp
\
err.cpp
\
fq.cpp
\
generic.cpp
\
io_object.cpp
\
io_thread.cpp
\
ip.cpp
\
...
...
@@ -113,6 +112,7 @@ libzmq_la_SOURCES = \
reaper.cpp
\
pub.cpp
\
random.cpp
\
router.cpp
\
rep.cpp
\
req.cpp
\
select
.cpp
\
...
...
src/
generic
.cpp
→
src/
router
.cpp
View file @
72a793f7
...
...
@@ -18,7 +18,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "
generic
.hpp"
#include "
router
.hpp"
#include "pipe.hpp"
#include "wire.hpp"
#include "random.hpp"
...
...
@@ -26,7 +26,7 @@
#include "wire.hpp"
#include "err.hpp"
zmq
::
generic_t
::
generic
_t
(
class
ctx_t
*
parent_
,
uint32_t
tid_
)
:
zmq
::
router_t
::
router
_t
(
class
ctx_t
*
parent_
,
uint32_t
tid_
)
:
socket_base_t
(
parent_
,
tid_
),
prefetched
(
false
),
more_in
(
false
),
...
...
@@ -34,18 +34,18 @@ zmq::generic_t::generic_t (class ctx_t *parent_, uint32_t tid_) :
more_out
(
false
),
next_peer_id
(
generate_random
())
{
options
.
type
=
ZMQ_
GENERIC
;
options
.
type
=
ZMQ_
ROUTER
;
prefetched_msg
.
init
();
}
zmq
::
generic_t
::~
generic
_t
()
zmq
::
router_t
::~
router
_t
()
{
zmq_assert
(
outpipes
.
empty
());
prefetched_msg
.
close
();
}
void
zmq
::
generic
_t
::
xattach_pipe
(
pipe_t
*
pipe_
)
void
zmq
::
router
_t
::
xattach_pipe
(
pipe_t
*
pipe_
)
{
zmq_assert
(
pipe_
);
...
...
@@ -82,7 +82,7 @@ void zmq::generic_t::xattach_pipe (pipe_t *pipe_)
++
next_peer_id
;
}
void
zmq
::
generic
_t
::
xterminated
(
pipe_t
*
pipe_
)
void
zmq
::
router
_t
::
xterminated
(
pipe_t
*
pipe_
)
{
fq
.
terminated
(
pipe_
);
...
...
@@ -104,12 +104,12 @@ void zmq::generic_t::xterminated (pipe_t *pipe_)
zmq_assert
(
false
);
}
void
zmq
::
generic
_t
::
xread_activated
(
pipe_t
*
pipe_
)
void
zmq
::
router
_t
::
xread_activated
(
pipe_t
*
pipe_
)
{
fq
.
activated
(
pipe_
);
}
void
zmq
::
generic
_t
::
xwrite_activated
(
pipe_t
*
pipe_
)
void
zmq
::
router
_t
::
xwrite_activated
(
pipe_t
*
pipe_
)
{
for
(
outpipes_t
::
iterator
it
=
outpipes
.
begin
();
it
!=
outpipes
.
end
();
++
it
)
{
...
...
@@ -122,7 +122,7 @@ void zmq::generic_t::xwrite_activated (pipe_t *pipe_)
zmq_assert
(
false
);
}
int
zmq
::
generic
_t
::
xsend
(
msg_t
*
msg_
,
int
flags_
)
int
zmq
::
router
_t
::
xsend
(
msg_t
*
msg_
,
int
flags_
)
{
// If this is the first part of the message it's the ID of the
// peer to send the message to.
...
...
@@ -188,7 +188,7 @@ int zmq::generic_t::xsend (msg_t *msg_, int flags_)
return
0
;
}
int
zmq
::
generic
_t
::
xrecv
(
msg_t
*
msg_
,
int
flags_
)
int
zmq
::
router
_t
::
xrecv
(
msg_t
*
msg_
,
int
flags_
)
{
// If there's a queued command, pass it to the caller.
if
(
unlikely
(
!
more_in
&&
!
pending_commands
.
empty
()))
{
...
...
@@ -236,7 +236,7 @@ int zmq::generic_t::xrecv (msg_t *msg_, int flags_)
return
0
;
}
int
zmq
::
generic
_t
::
rollback
(
void
)
int
zmq
::
router
_t
::
rollback
(
void
)
{
if
(
current_out
)
{
current_out
->
rollback
();
...
...
@@ -246,14 +246,14 @@ int zmq::generic_t::rollback (void)
return
0
;
}
bool
zmq
::
generic
_t
::
xhas_in
()
bool
zmq
::
router
_t
::
xhas_in
()
{
if
(
prefetched
)
return
true
;
return
fq
.
has_in
();
}
bool
zmq
::
generic
_t
::
xhas_out
()
bool
zmq
::
router
_t
::
xhas_out
()
{
// In theory, GENERIC socket is always ready for writing. Whether actual
// attempt to write succeeds depends on whitch pipe the message is going
...
...
src/
generic
.hpp
→
src/
router
.hpp
View file @
72a793f7
...
...
@@ -18,8 +18,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __ZMQ_
GENERIC
_HPP_INCLUDED__
#define __ZMQ_
GENERIC
_HPP_INCLUDED__
#ifndef __ZMQ_
ROUTER
_HPP_INCLUDED__
#define __ZMQ_
ROUTER
_HPP_INCLUDED__
#include <map>
#include <deque>
...
...
@@ -32,14 +32,13 @@
namespace
zmq
{
// TODO: This class uses O(n) scheduling. Rewrite it to use O(1) algorithm.
class
generic_t
:
class
router_t
:
public
socket_base_t
{
public
:
generic
_t
(
class
ctx_t
*
parent_
,
uint32_t
tid_
);
~
generic
_t
();
router
_t
(
class
ctx_t
*
parent_
,
uint32_t
tid_
);
~
router
_t
();
// Overloads of functions from socket_base_t.
void
xattach_pipe
(
class
pipe_t
*
pipe_
);
...
...
@@ -99,8 +98,8 @@ namespace zmq
typedef
std
::
deque
<
pending_command_t
>
pending_commands_t
;
pending_commands_t
pending_commands
;
generic_t
(
const
generic
_t
&
);
const
generic_t
&
operator
=
(
const
generic
_t
&
);
router_t
(
const
router
_t
&
);
const
router_t
&
operator
=
(
const
router
_t
&
);
};
}
...
...
src/socket_base.cpp
View file @
72a793f7
...
...
@@ -58,7 +58,7 @@
#include "xrep.hpp"
#include "xpub.hpp"
#include "xsub.hpp"
#include "
generic
.hpp"
#include "
router
.hpp"
bool
zmq
::
socket_base_t
::
check_tag
()
{
...
...
@@ -104,8 +104,8 @@ zmq::socket_base_t *zmq::socket_base_t::create (int type_, class ctx_t *parent_,
case
ZMQ_XSUB
:
s
=
new
(
std
::
nothrow
)
xsub_t
(
parent_
,
tid_
);
break
;
case
ZMQ_
GENERIC
:
s
=
new
(
std
::
nothrow
)
generic
_t
(
parent_
,
tid_
);
case
ZMQ_
ROUTER
:
s
=
new
(
std
::
nothrow
)
router
_t
(
parent_
,
tid_
);
break
;
default
:
errno
=
EINVAL
;
...
...
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