Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
lib/ipcc.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/ipcc.c b/lib/ipcc.c
index e6faebb..ea79370 100644
--- a/lib/ipcc.c
+++ b/lib/ipcc.c
@@ -82,6 +82,7 @@ ssize_t qb_ipcc_send(struct qb_ipcc_connection * c, const void
*msg_ptr,
size_t msg_len)
{
ssize_t res;
+ ssize_t res2;
if (msg_len > c->request.max_msg_size) {
return -EINVAL;
@@ -91,10 +92,13 @@ ssize_t qb_ipcc_send(struct qb_ipcc_connection * c, const void
*msg_ptr,
}
res = c->funcs.send(&c->request, msg_ptr, msg_len);
- if (res > 0 && c->needs_sock_for_poll) {
+ if (res == msg_len && c->needs_sock_for_poll) {
do {
- res = qb_ipc_us_send(&c->setup, msg_ptr, 1);
- } while (res == -EAGAIN);
+ res2 = qb_ipc_us_send(&c->setup, msg_ptr, 1);
+ } while (res2 == -EAGAIN);
+ if (res2 != 1) {
+ res = res2;
+ }
}
return res;
}
--
1.7.3.1
Show replies by date
My receint change adding in a call to recv_ready(, 10) was
really slowing down the shm performance.
So now I am rather retrying which doesn't slow it down
and also passes "make check".
Signed-off-by: Angus Salkeld <asalkeld(a)redhat.com>
---
lib/ipcc.c | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/ipcc.c b/lib/ipcc.c
index ea79370..5fb8039 100644
--- a/lib/ipcc.c
+++ b/lib/ipcc.c
@@ -134,11 +134,16 @@ ssize_t qb_ipcc_recv(struct qb_ipcc_connection * c, void *msg_ptr,
size_t msg_len)
{
int32_t res = 0;
+ int32_t retries = 0;
- res = c->funcs.recv(&c->response, msg_ptr, msg_len, 1000);
+ recv_retry:
+ retries++;
+ res = c->funcs.recv(&c->response, msg_ptr, msg_len, 100);
if (res == -EAGAIN && c->needs_sock_for_poll) {
- res = qb_ipc_us_recv_ready(&c->setup, 10);
- if (res < 0) {
+ res = qb_ipc_us_recv_ready(&c->setup, 0);
+ if (res == -EAGAIN && retries < 50) {
+ goto recv_retry;
+ } else if (res < 0) {
return res;
} else {
return -EAGAIN;
--
1.7.3.1