Skip to content

Commit 590162d

Browse files
committed
Fix compiler warnings for TCPServer class
1 parent cffa1ca commit 590162d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/comm/tcp_server.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ TCPServer::~TCPServer()
6464

6565
void TCPServer::init()
6666
{
67-
int err = (listen_fd_ = socket(AF_INET, SOCK_STREAM, 0));
68-
if (err == -1)
67+
socket_t err = (listen_fd_ = socket(AF_INET, SOCK_STREAM, 0));
68+
if (err < 0)
6969
{
7070
throw std::system_error(std::error_code(errno, std::generic_category()), "Failed to create socket endpoint");
7171
}
@@ -100,7 +100,8 @@ void TCPServer::shutdown()
100100
}
101101
#endif
102102

103-
struct sockaddr_in address = { 0 };
103+
struct sockaddr_in address;
104+
memset(&address, 0, sizeof(address));
104105
address.sin_family = AF_INET;
105106
address.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
106107
address.sin_port = htons(port_);

0 commit comments

Comments
 (0)