From 35630fe7ed183e86c44487e64717f37c4e2fe052 Mon Sep 17 00:00:00 2001 From: Benjamin Sergeant Date: Tue, 14 Apr 2020 21:50:26 -0700 Subject: [PATCH] new makefile target + better error description in Socket::readBytes --- ixwebsocket/IXSocket.cpp | 9 ++++++--- makefile | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/ixwebsocket/IXSocket.cpp b/ixwebsocket/IXSocket.cpp index 2c297df1..9ef78bb7 100644 --- a/ixwebsocket/IXSocket.cpp +++ b/ixwebsocket/IXSocket.cpp @@ -376,7 +376,8 @@ namespace ix { if (isCancellationRequested && isCancellationRequested()) { - return std::make_pair(false, std::string()); + const std::string errorMsg("Cancellation Requested"); + return std::make_pair(false, errorMsg); } size_t size = std::min(kChunkSize, length - output.size()); @@ -388,7 +389,8 @@ namespace ix } else if (ret <= 0 && !Socket::isWaitNeeded()) { - return std::make_pair(false, std::string()); + const std::string errorMsg("Recv Error"); + return std::make_pair(false, errorMsg); } if (onProgressCallback) onProgressCallback((int) output.size(), (int) length); @@ -397,7 +399,8 @@ namespace ix // This way we are not busy looping if (isReadyToRead(1) == PollResultType::Error) { - return std::make_pair(false, std::string()); + const std::string errorMsg("Poll Error"); + return std::make_pair(false, errorMsg); } } diff --git a/makefile b/makefile index d462d597..aaf53fe1 100644 --- a/makefile +++ b/makefile @@ -116,10 +116,12 @@ test_ubsan: (cd build/test ; ln -sf Debug/ixwebsocket_unittest) (cd test ; python2.7 run.py -r) -test_asan: +test_asan: build_test_asan + (cd test ; python2.7 run.py -r) + +build_test_asan: mkdir -p build && (cd build && cmake -GXcode -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_TEST=1 .. && xcodebuild -project ixwebsocket.xcodeproj -target ixwebsocket_unittest -enableAddressSanitizer YES) (cd build/test ; ln -sf Debug/ixwebsocket_unittest) - (cd test ; python2.7 run.py -r) test_tsan_openssl: mkdir -p build && (cd build && cmake -GXcode -DCMAKE_BUILD_TYPE=Debug -DUSE_TLS=1 -DUSE_TEST=1 -DUSE_OPEN_SSL=1 .. && xcodebuild -project ixwebsocket.xcodeproj -target ixwebsocket_unittest -enableThreadSanitizer YES)