Fix windows (#51)
* More fixes for Windows * fix tests for windows * qf for linux * clean up
This commit is contained in:
committed by
Benjamin Sergeant
parent
afb1626ceb
commit
1f6b497015
@ -32,17 +32,15 @@ set (SOURCES
|
||||
IXDNSLookupTest.cpp
|
||||
IXSocketTest.cpp
|
||||
IXSocketConnectTest.cpp
|
||||
IXWebSocketServerTest.cpp
|
||||
IXWebSocketPingTest.cpp
|
||||
IXWebSocketTestConnectionDisconnection.cpp
|
||||
)
|
||||
|
||||
# Some unittest don't work on windows yet
|
||||
if (NOT WIN32)
|
||||
list(APPEND SOURCES
|
||||
IXWebSocketCloseTest.cpp
|
||||
IXWebSocketServerTest.cpp
|
||||
IXWebSocketPingTest.cpp
|
||||
IXWebSocketPingTimeoutTest.cpp
|
||||
cmd_websocket_chat.cpp
|
||||
IXWebSocketTestConnectionDisconnection.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -108,7 +108,7 @@ namespace ix
|
||||
{
|
||||
log("Cannot compute a free port. bind error.");
|
||||
|
||||
::close(sockfd);
|
||||
Socket::closeSocket(sockfd);
|
||||
return getAnyFreePortRandom();
|
||||
}
|
||||
|
||||
@ -118,12 +118,12 @@ namespace ix
|
||||
{
|
||||
log("Cannot compute a free port. getsockname error.");
|
||||
|
||||
::close(sockfd);
|
||||
Socket::closeSocket(sockfd);
|
||||
return getAnyFreePortRandom();
|
||||
}
|
||||
|
||||
int port = ntohs(sa.sin_port);
|
||||
::close(sockfd);
|
||||
Socket::closeSocket(sockfd);
|
||||
|
||||
return port;
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ namespace
|
||||
public:
|
||||
WebSocketClient(int port, bool useHeartBeatMethod);
|
||||
|
||||
void subscribe(const std::string& channel);
|
||||
void start();
|
||||
void stop();
|
||||
bool isReady() const;
|
||||
@ -57,7 +56,7 @@ namespace
|
||||
std::string url;
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "ws://localhost:"
|
||||
ss << "ws://127.0.0.1:"
|
||||
<< _port
|
||||
<< "/";
|
||||
|
||||
@ -347,6 +346,9 @@ TEST_CASE("Websocket_ping_data_sent_setPingInterval", "[setPingInterval]")
|
||||
|
||||
webSocketClient.stop();
|
||||
|
||||
// without this sleep test fails on Windows
|
||||
ix::msleep(100);
|
||||
|
||||
// Here we test ping interval
|
||||
// client has sent data, but ping should have been sent no matter what
|
||||
// -> expected ping messages == 3 as 900+900+1300 = 3100 seconds, 1 ping sent every second
|
||||
|
@ -23,7 +23,6 @@ namespace
|
||||
public:
|
||||
WebSocketClient(int port, int pingInterval, int pingTimeout);
|
||||
|
||||
void subscribe(const std::string& channel);
|
||||
void start();
|
||||
void stop();
|
||||
bool isReady() const;
|
||||
@ -71,7 +70,7 @@ namespace
|
||||
std::string url;
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "ws://localhost:"
|
||||
ss << "ws://127.0.0.1:"
|
||||
<< _port
|
||||
<< "/";
|
||||
|
||||
|
@ -107,7 +107,7 @@ TEST_CASE("Websocket_server", "[websocket_server]")
|
||||
std::string errMsg;
|
||||
bool tls = false;
|
||||
std::shared_ptr<Socket> socket = createSocket(tls, errMsg);
|
||||
std::string host("localhost");
|
||||
std::string host("127.0.0.1");
|
||||
auto isCancellationRequested = []() -> bool
|
||||
{
|
||||
return false;
|
||||
@ -141,7 +141,7 @@ TEST_CASE("Websocket_server", "[websocket_server]")
|
||||
std::string errMsg;
|
||||
bool tls = false;
|
||||
std::shared_ptr<Socket> socket = createSocket(tls, errMsg);
|
||||
std::string host("localhost");
|
||||
std::string host("127.0.0.1");
|
||||
auto isCancellationRequested = []() -> bool
|
||||
{
|
||||
return false;
|
||||
@ -178,7 +178,7 @@ TEST_CASE("Websocket_server", "[websocket_server]")
|
||||
std::string errMsg;
|
||||
bool tls = false;
|
||||
std::shared_ptr<Socket> socket = createSocket(tls, errMsg);
|
||||
std::string host("localhost");
|
||||
std::string host("127.0.0.1");
|
||||
auto isCancellationRequested = []() -> bool
|
||||
{
|
||||
return false;
|
||||
|
@ -100,7 +100,7 @@ namespace
|
||||
std::string url;
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "ws://localhost:"
|
||||
ss << "ws://127.0.0.1:"
|
||||
<< _port
|
||||
<< "/"
|
||||
<< _user;
|
||||
|
Reference in New Issue
Block a user