From 56217910c0064b1c2edb07946b71d75ab60403e4 Mon Sep 17 00:00:00 2001 From: "flyingscorpio@clevo" Date: Fri, 21 Oct 2022 10:23:54 +0200 Subject: [PATCH] Add pipe for ClientSender, rename socket argument --- src/server.c | 6 +++--- src/server.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server.c b/src/server.c index 0e998de..a875592 100644 --- a/src/server.c +++ b/src/server.c @@ -89,13 +89,13 @@ int main(void) { } /* Thread, listens for incoming messages */ -void ClientListener(int sockid) { +void ClientListener(int client_sockid) { char buf[BUF_LEN]; int n = 0; while (1) { /* Read n bytes at a time, because we don't know how long the message will be */ - while ((n = read(sockid, buf, BUF_LEN)) > 0) { + while ((n = read(client_sockid, buf, BUF_LEN)) > 0) { // TODO: do somethig with the stream (push to global stack?) } if (n < 0) { @@ -106,7 +106,7 @@ void ClientListener(int sockid) { } /* Thread, sends messages to the client */ -void ClientSender(int sockid) {} +void ClientSender(int message_pipe, int client_sockid) {} /* Handles a client after its connection */ // TODO: remove this function diff --git a/src/server.h b/src/server.h index 7297bbd..62e6253 100644 --- a/src/server.h +++ b/src/server.h @@ -7,7 +7,7 @@ void ClientListener(int); /* Thread, sends messages to the client */ -void ClientSender(int); +void ClientSender(int, int); /* Handles a client after its connection */ void service(int);