From 4832dd19de73c1eabac20c57ec6f599c0c4b117f Mon Sep 17 00:00:00 2001 From: ruanshudong Date: Wed, 19 Feb 2020 11:14:50 +0800 Subject: [PATCH] fix run-http.bat --- examples/CMakeLists.txt | 4 ++-- examples/scripts/run-http.bat | 15 ++++++++++----- servant/tup/Tars.h | 8 ++++---- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index c25a3e7..3da9679 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -21,9 +21,9 @@ if(WIN32) COMMENT "call quick start: ${CMAKE_BINARY_DIR}") add_custom_target(run-http - WORKING_DIRECTORY ${CMAKE_BINARY_DIR} + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} DEPENDS HttpServer HttpClient - COMMAND ../servant/script/busybox.exe bash ../examples/scripts/run-http.bat + COMMAND servant/script/busybox.exe bash examples/scripts/run-http.bat ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} ${CMAKE_SOURCE_DIR} COMMENT "call run http") add_custom_target(run-auth diff --git a/examples/scripts/run-http.bat b/examples/scripts/run-http.bat index 88e57a3..cb7f0ca 100644 --- a/examples/scripts/run-http.bat +++ b/examples/scripts/run-http.bat @@ -1,19 +1,24 @@ echo "run-http.bat" +EXE_PATH=$1 +SRC_PATH=$2 + +echo ${EXE_PATH} ${SRC_PATH} + killall -9 HttpServer.exe sleep 1 -echo "start server: .\\bin\\Release\\HttpServer.exe --config=..\\examples\\HttpDemo\\HttpServer\\config.conf &" +echo "start server: ${EXE_PATH}/HttpServer.exe --config=${SRC_PATH}/examples/HttpDemo/HttpServer/config.conf &" -.\\bin\\Release\\HttpServer.exe --config=..\\examples\\HttpDemo\\HttpServer\\config.conf & +${EXE_PATH}/HttpServer.exe --config=${SRC_PATH}/examples/HttpDemo/HttpServer/config.conf & sleep 3 -echo "client: .\\bin\\Release\\HttpClient.exe" +echo "client: ${EXE_PATH}/HttpClient.exe" -.\\bin\\Release\\HttpClient.exe --count=10000 --thread=2 --call=basehttp -.\\bin\\Release\\HttpClient.exe --count=10000 --thread=2 --call=synchttp +${EXE_PATH}/HttpClient.exe --count=10000 --thread=2 --call=basehttp +#${EXE_PATH}/HttpClient.exe --count=10000 --thread=2 --call=synchttp sleep 1 diff --git a/servant/tup/Tars.h b/servant/tup/Tars.h index f3043b2..311757e 100755 --- a/servant/tup/Tars.h +++ b/servant/tup/Tars.h @@ -1857,7 +1857,7 @@ namespace tars throw TarsDecodeInvalidValue(ss); } TarsWriteToHead(*this, TarsHeadeString4, tag); - uint32_t n = (uint32_t)htonl(s.size()); + uint32_t n = htonl((uint32_t)s.size()); TarsWriteUInt32TTypeBuf(*this, n, (*this)._len); //this->writeBuf(s.data(), s.size()); TarsWriteTypeBuf(*this, s.data(), s.size()); @@ -1865,7 +1865,7 @@ namespace tars else { TarsWriteToHead(*this, TarsHeadeString1, tag); - uint8_t n = s.size(); + uint8_t n = (uint8_t)s.size(); TarsWriteUInt8TTypeBuf(*this, n, (*this)._len); //this->writeBuf(s.data(), s.size()); TarsWriteTypeBuf(*this, s.data(), s.size()); @@ -1887,7 +1887,7 @@ namespace tars //DataHead h(DataHead::eMap, tag); //h.writeTo(*this); TarsWriteToHead(*this, TarsHeadeMap, tag); - Int32 n = m.size(); + Int32 n = (Int32)m.size(); write(n, 0); typedef typename std::map::const_iterator IT; for (IT i = m.begin(); i != m.end(); ++i) @@ -1930,7 +1930,7 @@ namespace tars //hh.writeTo(*this); TarsWriteToHead(*this, TarsHeadeSimpleList, tag); TarsWriteToHead(*this, TarsHeadeChar, 0); - Int32 n = v.size(); + Int32 n = (Int32)v.size(); write(n, 0); //writeBuf(&v[0], v.size()); TarsWriteTypeBuf(*this, &v[0], v.size());