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
b78800e4
Commit
b78800e4
authored
Nov 09, 2012
by
Martin Hurton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify implementation of DEALER socket
parent
d1e0889a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
30 deletions
+2
-30
dealer.cpp
src/dealer.cpp
+2
-24
dealer.hpp
src/dealer.hpp
+0
-6
No files found.
src/dealer.cpp
View file @
b78800e4
...
@@ -24,8 +24,7 @@
...
@@ -24,8 +24,7 @@
#include "msg.hpp"
#include "msg.hpp"
zmq
::
dealer_t
::
dealer_t
(
class
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
)
:
zmq
::
dealer_t
::
dealer_t
(
class
ctx_t
*
parent_
,
uint32_t
tid_
,
int
sid_
)
:
socket_base_t
(
parent_
,
tid_
,
sid_
),
socket_base_t
(
parent_
,
tid_
,
sid_
)
prefetched
(
false
)
{
{
options
.
type
=
ZMQ_DEALER
;
options
.
type
=
ZMQ_DEALER
;
...
@@ -34,13 +33,10 @@ zmq::dealer_t::dealer_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
...
@@ -34,13 +33,10 @@ zmq::dealer_t::dealer_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
// If the socket is closing we can drop all the outbound requests. There'll
// If the socket is closing we can drop all the outbound requests. There'll
// be noone to receive the replies anyway.
// be noone to receive the replies anyway.
// options.delay_on_close = false;
// options.delay_on_close = false;
prefetched_msg
.
init
();
}
}
zmq
::
dealer_t
::~
dealer_t
()
zmq
::
dealer_t
::~
dealer_t
()
{
{
prefetched_msg
.
close
();
}
}
void
zmq
::
dealer_t
::
xattach_pipe
(
pipe_t
*
pipe_
,
bool
icanhasall_
)
void
zmq
::
dealer_t
::
xattach_pipe
(
pipe_t
*
pipe_
,
bool
icanhasall_
)
...
@@ -63,30 +59,12 @@ int zmq::dealer_t::xrecv (msg_t *msg_, int flags_)
...
@@ -63,30 +59,12 @@ int zmq::dealer_t::xrecv (msg_t *msg_, int flags_)
// flags_ is unused
// flags_ is unused
(
void
)
flags_
;
(
void
)
flags_
;
// If there is a prefetched message, return it.
if
(
prefetched
)
{
int
rc
=
msg_
->
move
(
prefetched_msg
);
errno_assert
(
rc
==
0
);
prefetched
=
false
;
return
0
;
}
return
fq
.
recv
(
msg_
);
return
fq
.
recv
(
msg_
);
}
}
bool
zmq
::
dealer_t
::
xhas_in
()
bool
zmq
::
dealer_t
::
xhas_in
()
{
{
// We may already have a message pre-fetched.
return
fq
.
has_in
();
if
(
prefetched
)
return
true
;
// Try to read the next message to the pre-fetch buffer.
int
rc
=
dealer_t
::
xrecv
(
&
prefetched_msg
,
ZMQ_DONTWAIT
);
if
(
rc
!=
0
&&
errno
==
EAGAIN
)
return
false
;
errno_assert
(
rc
==
0
);
prefetched
=
true
;
return
true
;
}
}
bool
zmq
::
dealer_t
::
xhas_out
()
bool
zmq
::
dealer_t
::
xhas_out
()
...
...
src/dealer.hpp
View file @
b78800e4
...
@@ -62,12 +62,6 @@ namespace zmq
...
@@ -62,12 +62,6 @@ namespace zmq
fq_t
fq
;
fq_t
fq
;
lb_t
lb
;
lb_t
lb
;
// Have we prefetched a message.
bool
prefetched
;
// Holds the prefetched message.
msg_t
prefetched_msg
;
dealer_t
(
const
dealer_t
&
);
dealer_t
(
const
dealer_t
&
);
const
dealer_t
&
operator
=
(
const
dealer_t
&
);
const
dealer_t
&
operator
=
(
const
dealer_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