summary refs log tree commit diff
path: root/client.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-10-25 03:04:45 -0400
committerJune McEnroe <june@causal.agency>2019-10-25 03:04:45 -0400
commit243a5f930dce0cddd54d7d927774f7ad82b3d88e (patch)
treef2730a84c336ac408af4fc2a9da795daf6c5234b /client.c
parentImplement client reading from ring buffer (diff)
downloadpounce-243a5f930dce0cddd54d7d927774f7ad82b3d88e.tar.gz
pounce-243a5f930dce0cddd54d7d927774f7ad82b3d88e.zip
Use produce/consume words for ring buffer
To disambiguate clientRecv and clientRead, say clientConsume.
Diffstat (limited to '')
-rw-r--r--client.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/client.c b/client.c
index cdf0009..4ac1ef4 100644
--- a/client.c
+++ b/client.c
@@ -38,7 +38,7 @@ enum Need {
 struct Client {
 	bool error;
 	struct tls *tls;
-	size_t reader;
+	size_t consumer;
 	enum Need need;
 	bool serverTime;
 	char buf[4096];
@@ -112,7 +112,7 @@ static void handleUser(struct Client *client, struct Message msg) {
 		client->error = true;
 		return;
 	}
-	client->reader = ringReader(msg.params[0]);
+	client->consumer = ringConsumer(msg.params[0]);
 	client->need &= ~NeedUser;
 	if (!client->need) stateSync(client);
 	if (client->need == NeedPass) passRequired(client);
@@ -231,13 +231,13 @@ void clientRecv(struct Client *client) {
 
 size_t clientDiff(const struct Client *client) {
 	if (client->need) return 0;
-	return ringDiff(client->reader);
+	return ringDiff(client->consumer);
 }
 
 // TODO: Read several lines based on LOWAT for POLLOUT?
-void clientRead(struct Client *client) {
+void clientConsume(struct Client *client) {
 	time_t time;
-	const char *line = ringRead(&time, client->reader);
+	const char *line = ringConsume(&time, client->consumer);
 	if (!line) return;
 	if (client->serverTime) {
 		char ts[sizeof("YYYY-MM-DDThh:mm:ss.sssZ")];