summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2012-04-16 15:10:21 +0200
committerMartin Sustrik <sustrik@250bpm.com>2012-04-16 15:10:21 +0200
commit0ad302e8cb506234c15f0992329b0ea6d580daf0 (patch)
tree227e02f8db5d772316ca1a9d5c0eabb5e5f2735b /src
parent48210efd8498cbf666919495ed5873b1355fce62 (diff)
Few trivial fixes to REQ/REP pattern.
- couple of comments adjusted - empty 'stack delimiter' message correctly closed - non-reachable function xrep_t::rollback() removed Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src')
-rw-r--r--src/req.cpp5
-rw-r--r--src/xrep.cpp17
-rw-r--r--src/xrep.hpp5
-rw-r--r--src/xreq.cpp2
4 files changed, 9 insertions, 20 deletions
diff --git a/src/req.cpp b/src/req.cpp
index da9dd0e..7dc97ea 100644
--- a/src/req.cpp
+++ b/src/req.cpp
@@ -55,9 +55,12 @@ int xs::req_t::xsend (msg_t *msg_, int flags_)
errno_assert (rc == 0);
bottom.set_flags (msg_t::more);
rc = xreq_t::xsend (&bottom, 0);
- if (rc != 0)
+ if (rc != 0) {
+ bottom.close ();
return -1;
+ }
message_begins = false;
+ bottom.close ();
}
bool more = msg_->flags () & msg_t::more ? true : false;
diff --git a/src/xrep.cpp b/src/xrep.cpp
index f0f2cde..007ed27 100644
--- a/src/xrep.cpp
+++ b/src/xrep.cpp
@@ -267,16 +267,6 @@ int xs::xrep_t::xrecv (msg_t *msg_, int flags_)
return 0;
}
-int xs::xrep_t::rollback (void)
-{
- if (current_out) {
- current_out->rollback ();
- current_out = NULL;
- more_out = false;
- }
- return 0;
-}
-
bool xs::xrep_t::xhas_in ()
{
// If we are in the middle of reading the messages, there are
@@ -310,9 +300,10 @@ bool xs::xrep_t::xhas_in ()
bool xs::xrep_t::xhas_out ()
{
- // In theory, XREP socket is always ready for writing. Whether actual
- // attempt to write succeeds depends on whitch pipe the message is going
- // to be routed to.
+ // XREP socket is always ready for writing. Whether actual
+ // attempt to send will succeed depends on whether the pipe the message
+ // is routed to is available for writing. If it's not, message will be
+ // dropped.
return true;
}
diff --git a/src/xrep.hpp b/src/xrep.hpp
index 514d61d..8e16a4c 100644
--- a/src/xrep.hpp
+++ b/src/xrep.hpp
@@ -58,11 +58,6 @@ namespace xs
void xwrite_activated (xs::pipe_t *pipe_);
void xterminated (xs::pipe_t *pipe_);
- protected:
-
- // Rollback any message parts that were sent but not yet flushed.
- int rollback ();
-
private:
// Fair queueing object for inbound pipes.
diff --git a/src/xreq.cpp b/src/xreq.cpp
index dd57aba..1c6af9d 100644
--- a/src/xreq.cpp
+++ b/src/xreq.cpp
@@ -68,7 +68,7 @@ int xs::xreq_t::xrecv (msg_t *msg_, int flags_)
return 0;
}
- // XREQ socket doesn't use identities. We can safely drop it and
+ // XREQ socket doesn't use identities. We can safely drop them.
while (true) {
int rc = fq.recv (msg_, flags_);
if (rc != 0)