summaryrefslogtreecommitdiffstats
path: root/src/dispatch.c
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-05-30 14:59:11 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-05-30 14:59:11 -0400
commit3d207eb9f9f4b3bdc7e4775622fe75d318d054ae (patch)
treeb1a93be89a1a54915c81bc3c2194c6c04a99c67e /src/dispatch.c
parent32dd26f4052b57bf1cdc7fad2cc47874ff989cc1 (diff)
downloadslapi-nis-3d207eb9f9f4b3bdc7e4775622fe75d318d054ae.tar.gz
slapi-nis-3d207eb9f9f4b3bdc7e4775622fe75d318d054ae.tar.xz
slapi-nis-3d207eb9f9f4b3bdc7e4775622fe75d318d054ae.zip
- move nis_all processing to a works-in-chunks state machine
Diffstat (limited to 'src/dispatch.c')
-rw-r--r--src/dispatch.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/dispatch.c b/src/dispatch.c
index a9f6e98..155d407 100644
--- a/src/dispatch.c
+++ b/src/dispatch.c
@@ -76,7 +76,7 @@ struct dispatch_client {
ssize_t client_query_size;
void *client_query_cookie;
/* The reply to the client, when we're sending one. */
- char client_outbuf[4096];
+ char client_outbuf[8192];
ssize_t client_outbuf_used;
/* This is a linked list. */
struct dispatch_client *client_next;
@@ -102,28 +102,28 @@ dispatch_reply_fragment_dgram(struct plugin_state *state,
xdr_replymsg(reply_xdrs, reply);
if (!first_fragment || !last_fragment) {
slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "Trying to sending datagram reply (%d bytes), "
+ "trying to sending datagram reply (%d bytes), "
"even though the reply is not suitable for "
- "transmission as a datagram.\n",
+ "transmission as a datagram\n",
xdr_getpos(reply_xdrs));
} else {
slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "Sending datagram reply (%d bytes).\n",
+ "sending datagram reply (%d bytes)\n",
xdr_getpos(reply_xdrs));
}
sendto(cdata->dgram.client_fd, reply_buf, xdr_getpos(reply_xdrs),
0, &cdata->dgram.client_addr, cdata->dgram.client_addrlen);
return TRUE;
}
-static bool_t
+static void
dispatch_reply_dgram(struct plugin_state *state,
struct dispatch_client_data *cdata,
struct rpc_msg *reply,
XDR *reply_xdrs, char *reply_buf)
{
- return dispatch_reply_fragment_dgram(state, cdata,
- reply, reply_xdrs, reply_buf,
- TRUE, TRUE);
+ dispatch_reply_fragment_dgram(state, cdata,
+ reply, reply_xdrs, reply_buf,
+ TRUE, TRUE);
}
/* Send a reply, buffered-for-connected-clients version. */
@@ -161,7 +161,7 @@ dispatch_write_with_retry(struct plugin_state *state, int fd,
default:
slapi_log_error(SLAPI_LOG_PLUGIN,
state->plugin_desc->spd_id,
- "Got error %s sending "
+ "got error %s sending "
"%d bytes (at %d) to %d.\n",
strerror(errno),
length1 + length2,
@@ -197,7 +197,7 @@ dispatch_reply_fragment_connected(struct plugin_state *state,
if (next_size > sizeof(cdata->connected->client_outbuf)) {
slapi_log_error(SLAPI_LOG_PLUGIN,
state->plugin_desc->spd_id,
- "Failed to queue stream reply (4+%d bytes)!\n",
+ "failed to queue stream reply (4+%d bytes)!n",
xdr_getpos(reply_xdrs));
return FALSE;
}
@@ -214,21 +214,21 @@ dispatch_reply_fragment_connected(struct plugin_state *state,
cdata->connected->client_outbuf_used += (4 + xdr_getpos(reply_xdrs));
slapi_log_error(SLAPI_LOG_PLUGIN,
state->plugin_desc->spd_id,
- "Queued stream reply (4+%d bytes), %d total!\n",
+ "queued stream reply (4+%d bytes), %d total in queue\n",
xdr_getpos(reply_xdrs),
cdata->connected->client_outbuf_used);
return TRUE;
}
/* Send an entire reply record at once. */
-static bool_t
+static void
dispatch_reply_connected(struct plugin_state *state,
struct dispatch_client_data *cdata,
struct rpc_msg *reply,
XDR *reply_xdrs, char *reply_buf)
{
- return dispatch_reply_fragment_connected(state, cdata,
- reply, reply_xdrs, reply_buf,
- TRUE, TRUE);
+ dispatch_reply_fragment_connected(state, cdata,
+ reply, reply_xdrs, reply_buf,
+ TRUE, TRUE);
}
/* Handle a datagram client -- read the request and handle it immediately. */
@@ -443,14 +443,14 @@ client_write(struct plugin_state *state, struct dispatch_client *client)
len = client->client_outbuf_used;
slapi_log_error(SLAPI_LOG_PLUGIN,
state->plugin_desc->spd_id,
- "Attempting to send %d bytes to %d.\n",
+ "attempting to send %d bytes to %d\n",
len, client->client_fd);
count = write(client->client_fd, client->client_outbuf, len);
if (count <= 0) {
if ((count != -1) || (errno != EAGAIN)) {
slapi_log_error(SLAPI_LOG_PLUGIN,
state->plugin_desc->spd_id,
- "Error sending %d bytes to %d.\n",
+ "error sending %d bytes to %d\n",
client->client_outbuf_used,
client->client_fd);
/* Fail, disconnect because we're out of sync. */
@@ -459,21 +459,21 @@ client_write(struct plugin_state *state, struct dispatch_client *client)
return;
}
slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "Sent %d bytes to %d.\n", count, client->client_fd);
+ "sent %d bytes to %d\n", count, client->client_fd);
if (count == client->client_outbuf_used) {
/* There's no more data to send. */
if (client->client_state == client_replying_final) {
/* Done. Go back to reading next time. */
slapi_log_error(SLAPI_LOG_PLUGIN,
state->plugin_desc->spd_id,
- "Waiting for next query on %d.\n",
+ "waiting for next query on %d\n",
client->client_fd);
client_set_reading(state, client);
} else {
/* More to send, so ask for more reply data. */
slapi_log_error(SLAPI_LOG_PLUGIN,
state->plugin_desc->spd_id,
- "Waiting for more data for %d.\n",
+ "waiting for more data for %d\n",
client->client_fd);
client->client_outbuf_used = 0;
memset(&client_data, 0, sizeof(client_data));