From 8693eef8febde4df90b7fbd1fb9ac813b132fa50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Mon, 20 Jul 2020 01:50:14 -0300 Subject: Wrap external functionality into classes --- src/server/client.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/server/client.cpp') diff --git a/src/server/client.cpp b/src/server/client.cpp index d6fc0fc..45f7501 100644 --- a/src/server/client.cpp +++ b/src/server/client.cpp @@ -2,15 +2,15 @@ #define pos(x, y) (x) + (y) * window_w struct Client { - int sockfd; + Socket io; Point cursor; Point window_start; - Client(const Buffer &b) : cursor(b), window_start(cursor) {} + Client(const Buffer &b, int fd) : io(fd), cursor(b), window_start(cursor) {} void parse_message() { int8_t message[MAX_MSG_SIZE] = {}; - read(sockfd, message, MAX_MSG_SIZE - 1); + io.recv(message, MAX_MSG_SIZE - 1); switch (message[0]) { case OP_MOVE1: move(message[1]); @@ -58,7 +58,7 @@ struct Client { } } - write(sockfd, view, window_w * window_h); + io.send(view, window_w * window_h); delete[] view; } -- cgit v1.2.3