From: Mark Wu <wudxw@linux.vnet.ibm.com>
To: wudx05@gmail.com
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Only flush queue or call sent callback on successful delivery
Date: Thu, 27 Oct 2011 16:50:16 +0800 [thread overview]
Message-ID: <1319705416-24285-1-git-send-email-wudxw@linux.vnet.ibm.com> (raw)
Now queue flushing and sent callback could be invoked even on delivery
failure. We add a checking of receiver's return value to avoid this
case.
Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
---
net/queue.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/net/queue.c b/net/queue.c
index 1ab5247..c9a027c 100644
--- a/net/queue.c
+++ b/net/queue.c
@@ -190,8 +190,9 @@ ssize_t qemu_net_queue_send(NetQueue *queue,
qemu_net_queue_append(queue, sender, flags, data, size, sent_cb);
return 0;
}
-
- qemu_net_queue_flush(queue);
+ if (ret > 0) {
+ qemu_net_queue_flush(queue);
+ }
return ret;
}
@@ -214,8 +215,9 @@ ssize_t qemu_net_queue_send_iov(NetQueue *queue,
qemu_net_queue_append_iov(queue, sender, flags, iov, iovcnt, sent_cb);
return 0;
}
-
- qemu_net_queue_flush(queue);
+ if (ret > 0) {
+ qemu_net_queue_flush(queue);
+ }
return ret;
}
@@ -251,7 +253,7 @@ void qemu_net_queue_flush(NetQueue *queue)
break;
}
- if (packet->sent_cb) {
+ if (ret > 0 && packet->sent_cb) {
packet->sent_cb(packet->sender, ret);
}
--
1.7.1
reply other threads:[~2011-10-27 8:51 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1319705416-24285-1-git-send-email-wudxw@linux.vnet.ibm.com \
--to=wudxw@linux.vnet.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=wudx05@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).