From 8ce7db9ba907ad4e826c826af898e1864f25f7bb Mon Sep 17 00:00:00 2001 From: cflip Date: Mon, 19 Sep 2022 21:53:40 -0600 Subject: Add ClangTidy configuration and apply fixes --- src/ServerConnection.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/ServerConnection.cpp') diff --git a/src/ServerConnection.cpp b/src/ServerConnection.cpp index afe9bcb..64692b6 100644 --- a/src/ServerConnection.cpp +++ b/src/ServerConnection.cpp @@ -1,8 +1,8 @@ #include "ServerConnection.h" #include +#include #include -#include #include #include #include @@ -19,13 +19,13 @@ static void error_and_die(const char* message) ServerConnection::ServerConnection(int port) { - sockaddr_in address; + sockaddr_in address {}; int socket_options = 1; if ((m_socket_fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) error_and_die("Failed to create socket"); - if (setsockopt(m_socket_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &socket_options, sizeof(socket_options))) + if (setsockopt(m_socket_fd, SOL_SOCKET, SO_REUSEADDR | SO_REUSEPORT, &socket_options, sizeof(socket_options)) != 0) error_and_die("setsockopt"); address.sin_family = AF_INET; @@ -39,8 +39,8 @@ ServerConnection::ServerConnection(int port) error_and_die("listen"); } -ClientConnection ServerConnection::accept_client_connection() +ClientConnection ServerConnection::accept_client_connection() const { int client_socket = accept(m_socket_fd, (sockaddr*)nullptr, nullptr); - return ClientConnection(client_socket); + return { client_socket }; } -- cgit v1.2.3