From 648947fe446cabcda56b6d4a767ad07dc2f5b796 Mon Sep 17 00:00:00 2001 From: Philipp Schafft Date: Thu, 26 Jul 2018 10:37:12 +0000 Subject: [PATCH] Cleanup: Provided connection_send_bytes() to avoid direct access to con->send() --- src/client.c | 2 +- src/connection.c | 5 +++++ src/connection.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client.c b/src/client.c index d2ed802f..bcebcc42 100644 --- a/src/client.c +++ b/src/client.c @@ -627,7 +627,7 @@ admin_format_t client_get_admin_format_by_content_negotiation(client_t *client) /* helper function for sending the data to a client */ int client_send_bytes(client_t *client, const void *buf, unsigned len) { - int ret = client->con->send(client->con, buf, len); + int ret = connection_send_bytes(client->con, buf, len); if (client->con->error) ICECAST_LOG_DEBUG("Client connection died"); diff --git a/src/connection.c b/src/connection.c index ead93786..3f483658 100644 --- a/src/connection.c +++ b/src/connection.c @@ -297,6 +297,11 @@ void connection_uses_tls(connection_t *con) #endif } +ssize_t connection_send_bytes(connection_t *con, const void *buf, size_t len) +{ + return con->send(con, buf, len); +} + ssize_t connection_read_bytes(connection_t *con, void *buf, size_t len) { ssize_t done = 0; diff --git a/src/connection.h b/src/connection.h index 5c6ab4f5..eb0b6980 100644 --- a/src/connection.h +++ b/src/connection.h @@ -60,6 +60,7 @@ int connection_complete_source(source_t *source, int response); void connection_queue(connection_t *con); void connection_uses_tls(connection_t *con); +ssize_t connection_send_bytes(connection_t *con, const void *buf, size_t len); ssize_t connection_read_bytes(connection_t *con, void *buf, size_t len); int connection_read_put_back(connection_t *con, const void *buf, size_t len);