Skip to content

Commit

Permalink
Some networking code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mleleszi committed Jun 15, 2024
1 parent 311d02c commit 5ed8ac4
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/tcp_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ TCPServer::TCPServer() : controller{} {
[[noreturn]] void TCPServer::start(const std::string &address = "0.0.0.0", int port = 6379) {
struct sockaddr_in server_addr {};
server_addr.sin_family = AF_INET;
server_addr.sin_addr.s_addr = INADDR_ANY;// TODO: set address

if (address == "0.0.0.0") {
server_addr.sin_addr.s_addr = INADDR_ANY;
} else {
inet_pton(AF_INET, address.c_str(), &server_addr.sin_addr);
}
server_addr.sin_port = htons(port);

if (bind(m_serverFD, (struct sockaddr *) &server_addr, sizeof(server_addr)) != 0) {
Expand Down

0 comments on commit 5ed8ac4

Please sign in to comment.