We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cffa1ca commit 590162dCopy full SHA for 590162d
src/comm/tcp_server.cpp
@@ -64,8 +64,8 @@ TCPServer::~TCPServer()
64
65
void TCPServer::init()
66
{
67
- int err = (listen_fd_ = socket(AF_INET, SOCK_STREAM, 0));
68
- if (err == -1)
+ socket_t err = (listen_fd_ = socket(AF_INET, SOCK_STREAM, 0));
+ if (err < 0)
69
70
throw std::system_error(std::error_code(errno, std::generic_category()), "Failed to create socket endpoint");
71
}
@@ -100,7 +100,8 @@ void TCPServer::shutdown()
100
101
#endif
102
103
- struct sockaddr_in address = { 0 };
+ struct sockaddr_in address;
104
+ memset(&address, 0, sizeof(address));
105
address.sin_family = AF_INET;
106
address.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
107
address.sin_port = htons(port_);
0 commit comments