You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kg...@apache.org on 2019/06/12 20:02:53 UTC
[qpid-dispatch] branch master updated: DISPATCH-1345: coalesce
QDR_LINK_WORK_FLOW events
This is an automated email from the ASF dual-hosted git repository.
kgiusti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-dispatch.git
The following commit(s) were added to refs/heads/master by this push:
new 89a4efe DISPATCH-1345: coalesce QDR_LINK_WORK_FLOW events
89a4efe is described below
commit 89a4efe40f35d0b87ffe5d99504eda5fd1c64e26
Author: Kenneth Giusti <kg...@apache.org>
AuthorDate: Tue May 28 12:57:18 2019 -0400
DISPATCH-1345: coalesce QDR_LINK_WORK_FLOW events
Closes #522
---
src/router_core/transfer.c | 32 ++++++++++++++++++++++++--------
1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/src/router_core/transfer.c b/src/router_core/transfer.c
index f23f0b9..9d8b544 100644
--- a/src/router_core/transfer.c
+++ b/src/router_core/transfer.c
@@ -784,16 +784,32 @@ void qdr_link_issue_credit_CT(qdr_core_t *core, qdr_link_t *link, int credit, bo
if (!drain_changed && credit == 0)
return;
- qdr_link_work_t *work = new_qdr_link_work_t();
- ZERO(work);
-
- work->work_type = QDR_LINK_WORK_FLOW;
- work->value = credit;
-
+ qdr_link_work_drain_action_t drain_action = QDR_LINK_WORK_DRAIN_ACTION_NONE;
if (drain_changed)
- work->drain_action = drain ? QDR_LINK_WORK_DRAIN_ACTION_SET : QDR_LINK_WORK_DRAIN_ACTION_CLEAR;
+ drain_action = drain ? QDR_LINK_WORK_DRAIN_ACTION_SET : QDR_LINK_WORK_DRAIN_ACTION_CLEAR;
+
+ qdr_connection_t *conn = link->conn;
+ sys_mutex_lock(conn->work_lock);
+ qdr_link_work_t *work = DEQ_TAIL(link->work_list);
+ // can we avoid adding a new work flow item?
+ if (work && work->work_type == QDR_LINK_WORK_FLOW
+ && (!drain_changed || work->drain_action == drain_action)) {
+ work->value += credit;
+ sys_mutex_unlock(conn->work_lock);
+ qdr_connection_activate_CT(core, conn);
- qdr_link_enqueue_work_CT(core, link, work);
+ } else {
+ sys_mutex_unlock(conn->work_lock);
+
+ // need a new work flow item
+ work = new_qdr_link_work_t();
+ ZERO(work);
+ work->work_type = QDR_LINK_WORK_FLOW;
+ work->value = credit;
+ if (drain_changed)
+ work->drain_action = drain_action;
+ qdr_link_enqueue_work_CT(core, link, work);
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org