On 09/01/19 10:28, ali hadi wrote:
We are currently facing some issues with the drain function in Proton
C++ 0.22.0 .
We are trying to do synchronous fetch with timeout by doing a drain
after the timeout expires.
However after the first drain request is done, the drain flag is not
reset to false causing all the following actions to also request a drain
from the sender.
Do you see the same behaviour against the latest release (0.26)? If so I
would raise a JIRA for this behaviour, it sounds like a bug.
We couldn’t find a way to change the drain flag in the
on_receiver_drain_finish function. Should I create a jira issue ?
I would expect that you would not need to directly change the flag, but
that once you get the on_receiver_drain_finish function the drain
'cycle' is complete and the flag is no longer set.
Indeed in messaging_adapter.cpp the draining flag on the receiver's
context does appear to be reset:
if (!pn_link_credit(lnk) && lctx.draining) {
lctx.draining = false;
receiver r(make_wrapper<receiver>(lnk));
handler.on_receiver_drain_finish(r);
}
I *think* it may be missing a pn_link_set_drain() as per attached patch.
(Also, shouldn't that be pn_link_remote_credit() in the test? or are
they guaranteed to be the same at this point?)
diff --git a/cpp/src/messaging_adapter.cpp b/cpp/src/messaging_adapter.cpp
index e01f29f2..e89a4eaa 100644
--- a/cpp/src/messaging_adapter.cpp
+++ b/cpp/src/messaging_adapter.cpp
@@ -84,6 +84,7 @@ void on_link_flow(messaging_handler& handler, pn_event_t* event) {
// receiver
if (!pn_link_credit(lnk) && lctx.draining) {
lctx.draining = false;
+ pn_link_set_drain(lnk, false);
receiver r(make_wrapper<receiver>(lnk));
handler.on_receiver_drain_finish(r);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]