On Tue, Dec 14, 2010 at 07:54:08AM +0000, Dietmar Maurer wrote:
Hi Angus,
Had you come right with the problems you were having?
Please apply the following patch to the example test server:
--- bms.c.org 2010-12-14 08:40:23.000000000 +0100 +++ bms.c 2010-12-14 08:41:11.000000000 +0100 @@ -127,7 +127,7 @@ perror("qb_ipcs_event_send"); } }
- return 0;
- return -1;
}
After recompile, the server continues to work - 'bmc' runs quite normal.
I thought it should be removed from the event loop if s1_msg_process_fn returns something < 0?
We that's not how it is currently designed.
Lest say you have hundreds of async requests comming in. Now you have a big input queue, to speed things up the IPC server processes a bunch of requests before going back to the poll loop. If during this you start having trouble processing them all - then you return -1 from your process_message function. This will cause the IPC server to stop doing bulk processing and go back to the poll loop.
If you want to block normal incomming requests use:
qb_ipcs_request_rate_limit(s, QB_IPCS_RATE_OFF);
then later to turn it on again
qb_ipcs_request_rate_limit(s, QB_IPCS_RATE_NORMAL);
Or to shutdown the connection.
qb_ipcs_disconnect(c);
The second problem is a bit artificial - don't know if we really need to handle that. When you apply the following patch:
--- bms.c.org 2010-12-14 08:40:23.000000000 +0100 +++ bms.c 2010-12-14 08:49:13.000000000 +0100 @@ -113,6 +113,9 @@ response.size = sizeof(struct qb_ipc_response_header); response.id = 13; response.error = 0;
- return 0;
- if (blocking) { res = qb_ipcs_response_send(c, &response, sizeof(response));
The client (bmc) hangs forever, Well, the server misbehaves and never send a response. I just thought a timeout on the client side would be a good idea?
Are you trying the latest? try "git pull".
I did the following:
diff --git a/tests/bmc.c b/tests/bmc.c index 5eafd56..065cf5b 100644 --- a/tests/bmc.c +++ b/tests/bmc.c @@ -103,6 +103,7 @@ repeat_send: res = qb_ipcc_recv(conn, &res_header, sizeof(struct qb_ipc_response_header)); + printf("qb_ipcc_recv: %d\n", res); if (res == -EAGAIN) { goto repeat_recv; } diff --git a/tests/bms.c b/tests/bms.c index c8a6c3b..85ad02e 100644 --- a/tests/bms.c +++ b/tests/bms.c @@ -105,6 +105,8 @@ static int32_t s1_msg_process_fn(qb_ipcs_connection_t *c, struct qb_ipc_response_header response; ssize_t res;
+ return 0; + if (verbose > 2) { printf("%s:%d %s > msg:%d, size:%d\n", __FILE__, __LINE__, __func__,
when I run this i get tons of: qb_ipcc_recv: -11 qb_ipcc_recv: -11 qb_ipcc_recv: -11
At which you can handle backing off or disconnecting.
Regards -Angus
- Dietmar