add -6 option to ws echo_server / cf #148

This commit is contained in:
Benjamin Sergeant
2020-01-26 16:44:44 -08:00
parent 5d4bb90703
commit aa12098cb5
5 changed files with 20 additions and 7 deletions

View File

@ -86,7 +86,7 @@ namespace ix
server.sin_family = _addressFamily;
server.sin_port = htons(_port);
if (inet_pton(_addressFamily, _host.c_str(), &server.sin_addr.s_addr) < 0)
if (inet_pton(_addressFamily, _host.c_str(), &server.sin_addr.s_addr) <= 0)
{
std::stringstream ss;
ss << "SocketServer::listen() error calling inet_pton "
@ -96,7 +96,7 @@ namespace ix
return std::make_pair(false, ss.str());
}
if (bind(_serverFd, (struct sockaddr*) &server, sizeof(server)) < 0)
if (bind(_serverFd, (struct sockaddr*) &server, sizeof(server)) <= 0)
{
std::stringstream ss;
ss << "SocketServer::listen() error calling bind "

View File

@ -42,6 +42,8 @@ namespace ix
// Get all the connected clients
std::set<std::shared_ptr<WebSocket>> getClients();
const static int kDefaultHandShakeTimeoutSecs;
private:
// Member variables
int _handshakeTimeoutSecs;
@ -52,7 +54,6 @@ namespace ix
std::mutex _clientsMutex;
std::set<std::shared_ptr<WebSocket>> _clients;
const static int kDefaultHandShakeTimeoutSecs;
const static bool kDefaultEnablePong;
// Methods