Compare commits

..

12 Commits

Author SHA1 Message Date
Benjamin Sergeant
2d02ae0f0c cobra_to_sentry / backtraces are reversed and line number is not extracted correctly 2019-06-13 10:18:40 -07:00
Benjamin Sergeant
a8879da4fc disable windows on CI for now 2019-06-10 22:10:43 -07:00
Benjamin Sergeant
5f4a430845 disable building ws on windows on travis 2019-06-10 22:01:19 -07:00
Benjamin Sergeant
b9231be305 (cmake) missing find_package(Threads) on UNIX 2019-06-10 13:39:22 -07:00
Benjamin Sergeant
7cb5cc05e4 Add -DUSE_VENDORED_THIRD_PARTY=1 to build ws 2019-06-10 13:26:41 -07:00
Benjamin Sergeant
750a752ac0 - mbedtls and zlib are searched with find_package, and we use the vendored version if nothing is found 2019-06-10 11:18:27 -07:00
Benjamin Sergeant
61e5f52286 - travis CI uses g++ on Linux 2019-06-09 14:27:45 -07:00
Benjamin Sergeant
ce0b716f54 compile error in IXWebSocketMessageQTest 2019-06-09 12:25:36 -07:00
Benjamin Sergeant
aae8e5ec65 fix IXWebSocketMessageQTest.cpp 2019-06-09 12:08:00 -07:00
Benjamin Sergeant
2723e8466e fix changelog 2019-06-09 12:02:38 -07:00
Benjamin Sergeant
f13c610352 update README to reflect the new API 2019-06-09 12:02:02 -07:00
Benjamin Sergeant
55c65b08bf - WebSocket::send() sends message in TEXT mode by default
- WebSocketMessage sets a new binary field, which tells whether the received incoming message is binary or text
2019-06-09 11:56:47 -07:00
11 changed files with 148 additions and 137 deletions

View File

@@ -12,30 +12,30 @@ matrix:
- python test/run.py - python test/run.py
- make ws - make ws
# # Linux # Linux
# - os: linux
# dist: xenial
# script:
# - python test/run.py
# - make ws
# env:
# - CC=gcc
# - CXX=g++
# Clang + Linux disabled for now
- os: linux - os: linux
dist: xenial dist: xenial
script: python test/run.py script:
- python test/run.py
- make ws
env: env:
- CC=clang - CC=gcc
- CXX=clang++ - CXX=g++
# Clang + Linux disabled for now
# - os: linux
# dist: xenial
# script: python test/run.py
# env:
# - CC=clang
# - CXX=clang++
# Windows # Windows
- os: windows # - os: windows
env: # env:
- CMAKE_PATH="/c/Program Files/CMake/bin" # - CMAKE_PATH="/c/Program Files/CMake/bin"
script: # script:
- export PATH=$CMAKE_PATH:$PATH # - export PATH=$CMAKE_PATH:$PATH
- cmake -DUSE_TLS=1 -DUSE_WS=1 -DUSE_MBED_TLS=1 . # # - cmake -DUSE_TLS=1 -DUSE_WS=1 -DUSE_MBED_TLS=1 -DUSE_VENDORED_THIRD_PARTY=1 .
- cmake --build --parallel . # # - cmake --build --parallel .
- python test/run.py # - python test/run.py

View File

@@ -1,13 +1,19 @@
# Changelog # Changelog
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [unreleased] - 2019-06-09
### Changed
- cobra_to_sentry / backtraces are reversed and line number is not extracted correctly
- mbedtls and zlib are searched with find_package, and we use the vendored version if nothing is found
- travis CI uses g++ on Linux
## [4.0.0] - 2019-06-09 ## [4.0.0] - 2019-06-09
### Changed ### Changed
- WebSocket::send() sends message in TEXT mode by default - WebSocket::send() sends message in TEXT mode by default
- WebSocketMessage sets a new binary field, which tells whether the received incoming message is binary or text - WebSocketMessage sets a new binary field, which tells whether the received incoming message is binary or text
- WebSocket::send takes a third arg, binary which default to true (can be text too) - WebSocket::send takes a third arg, binary which default to true (can be text too)
- WebSocket callback only take one object, a const ix::WebSocketMessagePtr& msg - WebSocket callback only take one object, a const ix::WebSocketMessagePtr& msg
- Add explicite WebSocket::sendBinary - Add explicit WebSocket::sendBinary method
- New headers + WebSocketMessage class to hold message data, still not used across the board - New headers + WebSocketMessage class to hold message data, still not used across the board
- Add test/compatibility folder with small servers and clients written in different languages and different libraries to test compatibility. - Add test/compatibility folder with small servers and clients written in different languages and different libraries to test compatibility.
- ws echo_server has a -g option to print a greeting message on connect - ws echo_server has a -g option to print a greeting message on connect

13
CMake/FindMbedTLS.cmake Normal file
View File

@@ -0,0 +1,13 @@
find_path(MBEDTLS_INCLUDE_DIRS mbedtls/ssl.h)
find_library(MBEDTLS_LIBRARY mbedtls)
find_library(MBEDX509_LIBRARY mbedx509)
find_library(MBEDCRYPTO_LIBRARY mbedcrypto)
set(MBEDTLS_LIBRARIES "${MBEDTLS_LIBRARY}" "${MBEDX509_LIBRARY}" "${MBEDCRYPTO_LIBRARY}")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MBEDTLS DEFAULT_MSG
MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
mark_as_advanced(MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)

View File

@@ -4,6 +4,8 @@
# #
cmake_minimum_required(VERSION 3.4.1) cmake_minimum_required(VERSION 3.4.1)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
project(ixwebsocket C CXX) project(ixwebsocket C CXX)
set (CMAKE_CXX_STANDARD 14) set (CMAKE_CXX_STANDARD 14)
@@ -20,64 +22,64 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
endif() endif()
set( IXWEBSOCKET_SOURCES set( IXWEBSOCKET_SOURCES
ixwebsocket/IXCancellationRequest.cpp
ixwebsocket/IXConnectionState.cpp
ixwebsocket/IXDNSLookup.cpp
ixwebsocket/IXHttpClient.cpp
ixwebsocket/IXNetSystem.cpp
ixwebsocket/IXSelectInterrupt.cpp
ixwebsocket/IXSelectInterruptFactory.cpp
ixwebsocket/IXSocket.cpp ixwebsocket/IXSocket.cpp
ixwebsocket/IXSocketServer.cpp
ixwebsocket/IXSocketConnect.cpp ixwebsocket/IXSocketConnect.cpp
ixwebsocket/IXSocketFactory.cpp ixwebsocket/IXSocketFactory.cpp
ixwebsocket/IXDNSLookup.cpp ixwebsocket/IXSocketServer.cpp
ixwebsocket/IXCancellationRequest.cpp ixwebsocket/IXUrlParser.cpp
ixwebsocket/IXNetSystem.cpp
ixwebsocket/IXWebSocket.cpp ixwebsocket/IXWebSocket.cpp
ixwebsocket/IXWebSocketServer.cpp ixwebsocket/IXWebSocketCloseConstants.cpp
ixwebsocket/IXWebSocketTransport.cpp
ixwebsocket/IXWebSocketHandshake.cpp ixwebsocket/IXWebSocketHandshake.cpp
ixwebsocket/IXWebSocketHttpHeaders.cpp
ixwebsocket/IXWebSocketMessageQueue.cpp
ixwebsocket/IXWebSocketPerMessageDeflate.cpp ixwebsocket/IXWebSocketPerMessageDeflate.cpp
ixwebsocket/IXWebSocketPerMessageDeflateCodec.cpp ixwebsocket/IXWebSocketPerMessageDeflateCodec.cpp
ixwebsocket/IXWebSocketPerMessageDeflateOptions.cpp ixwebsocket/IXWebSocketPerMessageDeflateOptions.cpp
ixwebsocket/IXWebSocketHttpHeaders.cpp ixwebsocket/IXWebSocketServer.cpp
ixwebsocket/IXHttpClient.cpp ixwebsocket/IXWebSocketTransport.cpp
ixwebsocket/IXUrlParser.cpp
ixwebsocket/LUrlParser.cpp ixwebsocket/LUrlParser.cpp
ixwebsocket/IXSelectInterrupt.cpp
ixwebsocket/IXSelectInterruptFactory.cpp
ixwebsocket/IXConnectionState.cpp
ixwebsocket/IXWebSocketCloseConstants.cpp
ixwebsocket/IXWebSocketMessageQueue.cpp
) )
set( IXWEBSOCKET_HEADERS set( IXWEBSOCKET_HEADERS
ixwebsocket/IXSocket.h
ixwebsocket/IXSocketServer.h
ixwebsocket/IXSocketConnect.h
ixwebsocket/IXSocketFactory.h
ixwebsocket/IXSetThreadName.h
ixwebsocket/IXDNSLookup.h
ixwebsocket/IXCancellationRequest.h ixwebsocket/IXCancellationRequest.h
ixwebsocket/IXConnectionState.h
ixwebsocket/IXDNSLookup.h
ixwebsocket/IXHttpClient.h
ixwebsocket/IXNetSystem.h ixwebsocket/IXNetSystem.h
ixwebsocket/IXProgressCallback.h ixwebsocket/IXProgressCallback.h
ixwebsocket/IXSelectInterrupt.h
ixwebsocket/IXSelectInterruptFactory.h
ixwebsocket/IXSetThreadName.h
ixwebsocket/IXSocket.h
ixwebsocket/IXSocketConnect.h
ixwebsocket/IXSocketFactory.h
ixwebsocket/IXSocketServer.h
ixwebsocket/IXUrlParser.h
ixwebsocket/IXWebSocket.h ixwebsocket/IXWebSocket.h
ixwebsocket/IXWebSocketServer.h ixwebsocket/IXWebSocketCloseConstants.h
ixwebsocket/IXWebSocketTransport.h
ixwebsocket/IXWebSocketHandshake.h
ixwebsocket/IXWebSocketSendInfo.h
ixwebsocket/IXWebSocketErrorInfo.h
ixwebsocket/IXWebSocketCloseInfo.h ixwebsocket/IXWebSocketCloseInfo.h
ixwebsocket/IXWebSocketOpenInfo.h ixwebsocket/IXWebSocketErrorInfo.h
ixwebsocket/IXWebSocketMessageType.h ixwebsocket/IXWebSocketHandshake.h
ixwebsocket/IXWebSocketHttpHeaders.h
ixwebsocket/IXWebSocketMessage.h ixwebsocket/IXWebSocketMessage.h
ixwebsocket/IXWebSocketMessageQueue.h
ixwebsocket/IXWebSocketMessageType.h
ixwebsocket/IXWebSocketOpenInfo.h
ixwebsocket/IXWebSocketPerMessageDeflate.h ixwebsocket/IXWebSocketPerMessageDeflate.h
ixwebsocket/IXWebSocketPerMessageDeflateCodec.h ixwebsocket/IXWebSocketPerMessageDeflateCodec.h
ixwebsocket/IXWebSocketPerMessageDeflateOptions.h ixwebsocket/IXWebSocketPerMessageDeflateOptions.h
ixwebsocket/IXWebSocketHttpHeaders.h ixwebsocket/IXWebSocketSendInfo.h
ixwebsocket/libwshandshake.hpp ixwebsocket/IXWebSocketServer.h
ixwebsocket/IXHttpClient.h ixwebsocket/IXWebSocketTransport.h
ixwebsocket/IXUrlParser.h
ixwebsocket/LUrlParser.h ixwebsocket/LUrlParser.h
ixwebsocket/IXSelectInterrupt.h ixwebsocket/libwshandshake.hpp
ixwebsocket/IXSelectInterruptFactory.h
ixwebsocket/IXConnectionState.h
ixwebsocket/IXWebSocketCloseConstants.h
ixwebsocket/IXWebSocketMessageQueue.h
) )
if (UNIX) if (UNIX)
@@ -132,6 +134,11 @@ if (APPLE AND USE_TLS AND NOT USE_MBED_TLS)
target_link_libraries(ixwebsocket "-framework foundation" "-framework security") target_link_libraries(ixwebsocket "-framework foundation" "-framework security")
endif() endif()
if (UNIX)
find_package(Threads)
target_link_libraries(ixwebsocket ${CMAKE_THREAD_LIBS_INIT})
endif()
if (USE_OPEN_SSL) if (USE_OPEN_SSL)
find_package(OpenSSL REQUIRED) find_package(OpenSSL REQUIRED)
add_definitions(${OPENSSL_DEFINITIONS}) add_definitions(${OPENSSL_DEFINITIONS})
@@ -141,25 +148,28 @@ if (USE_OPEN_SSL)
endif() endif()
if (USE_MBED_TLS) if (USE_MBED_TLS)
set (ENABLE_PROGRAMS OFF) if (USE_VENDORED_THIRD_PARTY)
add_subdirectory(third_party/mbedtls) set (ENABLE_PROGRAMS OFF)
include_directories(third_party/mbedtls/include) add_subdirectory(third_party/mbedtls)
include_directories(third_party/mbedtls/include)
target_link_libraries(ixwebsocket mbedtls) target_link_libraries(ixwebsocket mbedtls)
else()
find_package(MbedTLS REQUIRED)
include_directories(${MBEDTLS_INCLUDE_DIRS})
target_link_libraries(ixwebsocket ${MBEDTLS_LIBRARIES})
endif()
endif() endif()
if (WIN32) find_package(ZLIB REQUIRED)
if (ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIRS})
target_link_libraries(ixwebsocket ${ZLIB_LIBRARIES})
else()
add_subdirectory(third_party/zlib) add_subdirectory(third_party/zlib)
include_directories(third_party/zlib ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib) include_directories(third_party/zlib ${CMAKE_CURRENT_BINARY_DIR}/third_party/zlib)
target_link_libraries(ixwebsocket zlibstatic wsock32 ws2_32) target_link_libraries(ixwebsocket zlibstatic wsock32 ws2_32)
add_definitions(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
else()
# gcc/Linux needs -pthread
find_package(Threads)
target_link_libraries(ixwebsocket
z ${CMAKE_THREAD_LIBS_INIT})
endif() endif()
set( IXWEBSOCKET_INCLUDE_DIRS set( IXWEBSOCKET_INCLUDE_DIRS
@@ -171,7 +181,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
target_compile_options(ixwebsocket PRIVATE /MP) target_compile_options(ixwebsocket PRIVATE /MP)
endif() endif()
target_include_directories( ixwebsocket PUBLIC ${IXWEBSOCKET_INCLUDE_DIRS} ) target_include_directories(ixwebsocket PUBLIC ${IXWEBSOCKET_INCLUDE_DIRS})
set_target_properties(ixwebsocket PROPERTIES PUBLIC_HEADER "${IXWEBSOCKET_HEADERS}") set_target_properties(ixwebsocket PROPERTIES PUBLIC_HEADER "${IXWEBSOCKET_HEADERS}")

View File

@@ -1 +1 @@
4.0.0 4.0.4

View File

@@ -33,27 +33,22 @@ webSocket.disablePerMessageDeflate();
// Setup a callback to be fired when a message or an event (open, close, error) is received // Setup a callback to be fired when a message or an event (open, close, error) is received
webSocket.setOnMessageCallback( webSocket.setOnMessageCallback(
[](ix::WebSocketMessageType messageType, [](const ix::WebSocketMessagePtr& msg)
const std::string& str,
size_t wireSize,
const ix::WebSocketErrorInfo& error,
const ix::WebSocketOpenInfo& openInfo,
const ix::WebSocketCloseInfo& closeInfo)
{ {
if (messageType == ix::WebSocketMessageType::Message) if (msg->type == ix::WebSocketMessageType::Message)
{ {
std::cout << str << std::endl; std::cout << msg->str << std::endl;
} }
}); });
// Now that our callback is setup, we can start our background thread and receive messages // Now that our callback is setup, we can start our background thread and receive messages
webSocket.start(); webSocket.start();
// Send a message to the server (default to BINARY mode) // Send a message to the server (default to TEXT mode)
webSocket.send("hello world"); webSocket.send("hello world");
// The message can be sent in TEXT mode // The message can be sent in BINARY mode (useful if you send MsgPack data for example)
webSocket.sendText("hello again"); webSocket.sendBinary("some serialized binary data");
// ... finally ... // ... finally ...
@@ -73,14 +68,9 @@ server.setOnConnectionCallback(
std::shared_ptr<ConnectionState> connectionState) std::shared_ptr<ConnectionState> connectionState)
{ {
webSocket->setOnMessageCallback( webSocket->setOnMessageCallback(
[webSocket, connectionState, &server](ix::WebSocketMessageType messageType, [webSocket, connectionState, &server](const ix::WebSocketMessagePtr msg)
const std::string& str,
size_t wireSize,
const ix::WebSocketErrorInfo& error,
const ix::WebSocketOpenInfo& openInfo,
const ix::WebSocketCloseInfo& closeInfo)
{ {
if (messageType == ix::WebSocketMessageType::Open) if (msg->type == ix::WebSocketMessageType::Open)
{ {
std::cerr << "New connection" << std::endl; std::cerr << "New connection" << std::endl;
@@ -91,19 +81,21 @@ server.setOnConnectionCallback(
std::cerr << "id: " << connectionState->getId() << std::endl; std::cerr << "id: " << connectionState->getId() << std::endl;
// The uri the client did connect to. // The uri the client did connect to.
std::cerr << "Uri: " << openInfo.uri << std::endl; std::cerr << "Uri: " << msg->openInfo.uri << std::endl;
std::cerr << "Headers:" << std::endl; std::cerr << "Headers:" << std::endl;
for (auto it : openInfo.headers) for (auto it : msg->openInfo.headers)
{ {
std::cerr << it.first << ": " << it.second << std::endl; std::cerr << it.first << ": " << it.second << std::endl;
} }
} }
else if (messageType == ix::WebSocketMessageType::Message) else if (msg->type == ix::WebSocketMessageType::Message)
{ {
// For an echo server, we just send back to the client whatever was received by the server // For an echo server, we just send back to the client whatever was received by the server
// All connected clients are available in an std::set. See the broadcast cpp example. // All connected clients are available in an std::set. See the broadcast cpp example.
webSocket->send(str); // Second parameter tells whether we are sending the message in binary or text mode.
// Here we send it in the same mode as it was received.
webSocket->send(msg->str, msg->binary);
} }
} }
); );
@@ -334,32 +326,27 @@ The onMessage event will be fired when the connection is opened or closed. This
``` ```
webSocket.setOnMessageCallback( webSocket.setOnMessageCallback(
[](ix::WebSocketMessageType messageType, [](const ix::WebSocketMessagePtr& msg)
const std::string& str,
size_t wireSize,
const ix::WebSocketErrorInfo& error,
const ix::WebSocketOpenInfo& openInfo,
const ix::WebSocketCloseInfo& closeInfo)
{ {
if (messageType == ix::WebSocketMessageType::Open) if (msg->type == ix::WebSocketMessageType::Open)
{ {
std::cout << "send greetings" << std::endl; std::cout << "send greetings" << std::endl;
// Headers can be inspected (pairs of string/string) // Headers can be inspected (pairs of string/string)
std::cout << "Handshake Headers:" << std::endl; std::cout << "Handshake Headers:" << std::endl;
for (auto it : headers) for (auto it : msg->headers)
{ {
std::cout << it.first << ": " << it.second << std::endl; std::cout << it.first << ": " << it.second << std::endl;
} }
} }
else if (messageType == ix::WebSocketMessageType::Close) else if (msg->type == ix::WebSocketMessageType::Close)
{ {
std::cout << "disconnected" << std::endl; std::cout << "disconnected" << std::endl;
// The server can send an explicit code and reason for closing. // The server can send an explicit code and reason for closing.
// This data can be accessed through the closeInfo object. // This data can be accessed through the closeInfo object.
std::cout << closeInfo.code << std::endl; std::cout << msg->closeInfo.code << std::endl;
std::cout << closeInfo.reason << std::endl; std::cout << msg->closeInfo.reason << std::endl;
} }
} }
); );
@@ -371,20 +358,15 @@ A message will be fired when there is an error with the connection. The message
``` ```
webSocket.setOnMessageCallback( webSocket.setOnMessageCallback(
[](ix::WebSocketMessageType messageType, [](const ix::WebSocketMessagePtr& msg)
const std::string& str,
size_t wireSize,
const ix::WebSocketErrorInfo& error,
const ix::WebSocketOpenInfo& openInfo,
const ix::WebSocketCloseInfo& closeInfo)
{ {
if (messageType == ix::WebSocketMessageType::Error) if (msg->type == ix::WebSocketMessageType::Error)
{ {
std::stringstream ss; std::stringstream ss;
ss << "Error: " << error.reason << std::endl; ss << "Error: " << msg->errorInfo.reason << std::endl;
ss << "#retries: " << event.retries << std::endl; ss << "#retries: " << msg->eventInfo.retries << std::endl;
ss << "Wait time(ms): " << event.wait_time << std::endl; ss << "Wait time(ms): " << msg->eventInfo.wait_time << std::endl;
ss << "HTTP Status: " << event.http_status << std::endl; ss << "HTTP Status: " << msg->eventInfo.http_status << std::endl;
std::cout << ss.str() << std::endl; std::cout << ss.str() << std::endl;
} }
} }
@@ -411,17 +393,12 @@ Ping/pong messages are used to implement keep-alive. 2 message types exists to i
``` ```
webSocket.setOnMessageCallback( webSocket.setOnMessageCallback(
[](ix::WebSocketMessageType messageType, [](const ix::WebSocketMessagePtr& msg)
const std::string& str,
size_t wireSize,
const ix::WebSocketErrorInfo& error,
const ix::WebSocketOpenInfo& openInfo,
const ix::WebSocketCloseInfo& closeInfo)
{ {
if (messageType == ix::WebSocketMessageType::Ping || if (msg->type == ix::WebSocketMessageType::Ping ||
messageType == ix::WebSocketMessageType::Pong) msg->type == ix::WebSocketMessageType::Pong)
{ {
std::cout << "pong data: " << str << std::endl; std::cout << "pong data: " << msg->str << std::endl;
} }
} }
); );

View File

@@ -12,7 +12,7 @@ brew:
mkdir -p build && (cd build ; cmake -DUSE_TLS=1 -DUSE_WS=1 .. ; make -j install) mkdir -p build && (cd build ; cmake -DUSE_TLS=1 -DUSE_WS=1 .. ; make -j install)
ws: ws:
mkdir -p build && (cd build ; cmake -DUSE_TLS=1 -DUSE_WS=1 -DUSE_MBED_TLS=1 .. ; make -j) mkdir -p build && (cd build ; cmake -DUSE_TLS=1 -DUSE_WS=1 -DUSE_MBED_TLS=1 -DUSE_VENDORED_THIRD_PARTY=1 .. ; make -j)
uninstall: uninstall:
xargs rm -fv < build/install_manifest.txt xargs rm -fv < build/install_manifest.txt

View File

@@ -200,7 +200,7 @@ namespace ix
{ {
if (client != webSocket) if (client != webSocket)
{ {
client->send(msg->str); client->send(msg->str, msg->binary);
} }
} }
} }

View File

@@ -30,7 +30,7 @@ namespace
Logger() << "New connection"; Logger() << "New connection";
connectionState->computeId(); connectionState->computeId();
Logger() << "id: " << connectionState->getId(); Logger() << "id: " << connectionState->getId();
Logger() << "Uri: " << openInfo.uri; Logger() << "Uri: " << msg->openInfo.uri;
Logger() << "Headers:"; Logger() << "Headers:";
for (auto&& it : msg->openInfo.headers) for (auto&& it : msg->openInfo.headers)
{ {
@@ -43,11 +43,11 @@ namespace
} }
else if (msg->type == ix::WebSocketMessageType::Message) else if (msg->type == ix::WebSocketMessageType::Message)
{ {
Logger() << "Message received: " << str; Logger() << "Message received: " << msg->str;
for (auto&& client : server.getClients()) for (auto&& client : server.getClients())
{ {
client->send(str); client->send(msg->str);
} }
} }
} }
@@ -89,25 +89,25 @@ namespace
} }
else if (msg->type == WebSocketMessageType::Error) else if (msg->type == WebSocketMessageType::Error)
{ {
ss << "Error ! " << error.reason; ss << "Error ! " << msg->errorInfo.reason;
log(ss.str()); log(ss.str());
testDone = true; testDone = true;
} }
else if (msg->type == WebSocketMessageType::Pong) else if (msg->type == WebSocketMessageType::Pong)
{ {
ss << "Received pong message " << str; ss << "Received pong message " << msg->str;
log(ss.str()); log(ss.str());
} }
else if (msg->type == WebSocketMessageType::Ping) else if (msg->type == WebSocketMessageType::Ping)
{ {
ss << "Received ping message " << str; ss << "Received ping message " << msg->str;
log(ss.str()); log(ss.str());
} }
else if (msg->type == WebSocketMessageType::Message) else if (msg->type == WebSocketMessageType::Message)
{ {
REQUIRE(str.compare("Hey dude!") == 0); REQUIRE(msg->str.compare("Hey dude!") == 0);
++receivedCount; ++receivedCount;
ss << "Received message " << str; ss << "Received message " << msg->str;
log(ss.str()); log(ss.str());
sendNextMessage(); sendNextMessage();
} }

View File

@@ -99,8 +99,10 @@ def runCMake(sanitizer, buildDir):
#generator = '"NMake Makefiles"' #generator = '"NMake Makefiles"'
#generator = '"Visual Studio 16 2019"' #generator = '"Visual Studio 16 2019"'
generator = '"Visual Studio 15 2017"' generator = '"Visual Studio 15 2017"'
USE_VENDORED_THIRD_PARTY = 'ON'
else: else:
generator = '"Unix Makefiles"' generator = '"Unix Makefiles"'
USE_VENDORED_THIRD_PARTY = 'OFF'
CMAKE_BUILD_TYPE = BUILD_TYPE CMAKE_BUILD_TYPE = BUILD_TYPE
@@ -110,6 +112,7 @@ def runCMake(sanitizer, buildDir):
-DCMAKE_BUILD_TYPE={CMAKE_BUILD_TYPE} \ -DCMAKE_BUILD_TYPE={CMAKE_BUILD_TYPE} \
-DUSE_TLS=1 \ -DUSE_TLS=1 \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DUSE_VENDORED_THIRD_PARTY={USE_VENDORED_THIRD_PARTY} \
-G{generator}' -G{generator}'
cmakeCmd = fmt.format(**locals()) cmakeCmd = fmt.format(**locals())

View File

@@ -72,7 +72,6 @@ namespace ix
std::string line; std::string line;
std::stringstream tokenStream(stack); std::stringstream tokenStream(stack);
std::stringstream ss;
std::smatch group; std::smatch group;
while (std::getline(tokenStream, line)) while (std::getline(tokenStream, line))
@@ -84,6 +83,7 @@ namespace ix
const auto linenoStr = group.str(2); const auto linenoStr = group.str(2);
const auto function = group.str(3); const auto function = group.str(3);
std::stringstream ss;
ss << linenoStr; ss << linenoStr;
uint64_t lineno; uint64_t lineno;
ss >> lineno; ss >> lineno;
@@ -97,6 +97,8 @@ namespace ix
} }
} }
std::reverse(frames.begin(), frames.end());
return frames; return frames;
} }