fix netthread spell bug

This commit is contained in:
ruanshudong 2020-04-06 21:09:28 +08:00
parent 97d34e16f5
commit 94f8cf8d18
3 changed files with 45 additions and 62 deletions

View File

@ -66,6 +66,10 @@ macro(build_tars_server MODULE DEPS)
target_link_libraries(${MODULE} ${LIB_HTTP2}) target_link_libraries(${MODULE} ${LIB_HTTP2})
endif() endif()
if(TARS_GPERF)
target_link_libraries(${MODULE} ${LIB_GPERF})
endif(TARS_GPERF)
SET(MODULE-TGZ "${CMAKE_BINARY_DIR}/${MODULE}.tgz") SET(MODULE-TGZ "${CMAKE_BINARY_DIR}/${MODULE}.tgz")
SET(RUN_DEPLOY_COMMAND_FILE "${PROJECT_BINARY_DIR}/run-deploy-${MODULE}.cmake") SET(RUN_DEPLOY_COMMAND_FILE "${PROJECT_BINARY_DIR}/run-deploy-${MODULE}.cmake")
FILE(WRITE ${RUN_DEPLOY_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/deploy/${MODULE})\n") FILE(WRITE ${RUN_DEPLOY_COMMAND_FILE} "EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/deploy/${MODULE})\n")

View File

@ -3,6 +3,7 @@ option(TARS_MYSQL "option for mysql" ON)
option(TARS_SSL "option for ssl" OFF) option(TARS_SSL "option for ssl" OFF)
option(TARS_HTTP2 "option for http2" OFF) option(TARS_HTTP2 "option for http2" OFF)
option(TARS_PROTOBUF "option for protocol" OFF) option(TARS_PROTOBUF "option for protocol" OFF)
option(TARS_GPERF "option for gperf" OFF)
IF(UNIX) IF(UNIX)
FIND_PACKAGE(ZLIB) FIND_PACKAGE(ZLIB)
@ -18,21 +19,10 @@ ENDIF(UNIX)
if (TARS_MYSQL) if (TARS_MYSQL)
add_definitions(-DTARS_MYSQL=1) add_definitions(-DTARS_MYSQL=1)
endif ()
# IF(UNIX AND NOT APPLE) if (TARS_GPERF)
# FIND_PACKAGE(Curses) add_definitions(-DTARS_GPERF=1)
# IF(NOT CURSES_FOUND)
# SET(ERRORMSG "Curses library not found. Please install appropriate package,
# remove CMakeCache.txt and rerun cmake.")
# IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
# SET(ERRORMSG ${ERRORMSG}
# "On Debian/Ubuntu, package name is libncurses5-dev(apt-get install libncurses5-dev), on Redhat/Centos and derivates "
# "it is ncurses-devel (yum install ncurses-devel).")
# ENDIF()
# MESSAGE(FATAL_ERROR ${ERRORMSG})
# ENDIF()
# ENDIF()
endif () endif ()
if (TARS_SSL) if (TARS_SSL)
@ -63,6 +53,41 @@ add_custom_target(thirdparty)
include(ExternalProject) include(ExternalProject)
if (TARS_GPERF)
set(GPERF_DIR_INC "${THIRDPARTY_PATH}/gpref/include")
set(GRPEF_DIR_LIB "${THIRDPARTY_PATH}/gpref/lib")
include_directories(${GPERF_DIR_INC})
link_directories(${GRPEF_DIR_LIB})
if (UNIX)
set(LIB_GPERF "profiler")
ExternalProject_Add(ADD_${LIB_GPERF}
URL https://tars-thirdpart-1300910346.cos.ap-guangzhou.myqcloud.com//src/gperftools-2.7.tar.gz
DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/download
PREFIX ${CMAKE_BINARY_DIR}
INSTALL_DIR ${CMAKE_SOURCE_DIR}
CONFIGURE_COMMAND ./configure --prefix=${CMAKE_BINARY_DIR}/src/gpref --disable-shared --disable-debugalloc
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/gpref-lib
BUILD_IN_SOURCE 1
BUILD_COMMAND make
# INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install
URL_MD5 c6a852a817e9160c79bdb2d3101b4601
)
add_dependencies(thirdparty ADD_${LIB_GPERF})
INSTALL(FILES ${CMAKE_BINARY_DIR}/src/gpref/bin/pprof
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ GROUP_EXECUTE GROUP_READ
DESTINATION thirdparty/bin/)
INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/gpref/lib DESTINATION thirdparty)
INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/gpref/include/gperftools DESTINATION thirdparty/include)
endif (UNIX)
endif (TARS_GPERF)
set(LIB_GTEST "libgtest") set(LIB_GTEST "libgtest")
if(WIN32) if(WIN32)
@ -82,23 +107,6 @@ if(WIN32)
add_dependencies(thirdparty ADD_CURL) add_dependencies(thirdparty ADD_CURL)
INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/curl/ DESTINATION thirdparty) INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/curl/ DESTINATION thirdparty)
# ExternalProject_Add(ADD_BUSYBOX
# URL http://cdn.tarsyun.com/src/busybox-1.31.1.tar.bz2
# DOWNLOAD_DIR ${CMAKE_SOURCE_DIR}/download
# PREFIX ${CMAKE_BINARY_DIR}
# INSTALL_DIR ${CMAKE_SOURCE_DIR}
# CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/busybox
# SOURCE_DIR ${CMAKE_BINARY_DIR}/src/busybox-lib
# BUILD_IN_SOURCE 1
# BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release
# INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install
# URL_MD5 70913edaf2263a157393af07565c17f0
# )
# add_dependencies(thirdparty ADD_BUSYBOX)
# INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/busybox/ DESTINATION thirdparty)
endif(WIN32) endif(WIN32)
if (WIN32) if (WIN32)
@ -113,8 +121,6 @@ if (WIN32)
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install
# LOG_CONFIGURE 1
# LOG_BUILD 1
URL_MD5 82358affdd7ab94854c8ee73a180fc53 URL_MD5 82358affdd7ab94854c8ee73a180fc53
) )
else() else()
@ -127,15 +133,11 @@ else()
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/gtest-lib SOURCE_DIR ${CMAKE_BINARY_DIR}/src/gtest-lib
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
BUILD_COMMAND make BUILD_COMMAND make
# LOG_CONFIGURE 1
# LOG_BUILD 1
# INSTALL_COMMAND ${CMAKE_COMMAND} -P ${RUN_PROTOBUF_INSTALL_FILE}
URL_MD5 ecd1fa65e7de707cd5c00bdac56022cd URL_MD5 ecd1fa65e7de707cd5c00bdac56022cd
) )
endif() endif()
INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/gtest/ DESTINATION thirdparty) INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/gtest/ DESTINATION thirdparty)
#INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/gtest/ DESTINATION thirdparty/include)
add_dependencies(thirdparty ADD_${LIB_GTEST}) add_dependencies(thirdparty ADD_${LIB_GTEST})
@ -160,8 +162,6 @@ if (TARS_PROTOBUF)
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/protobuf-lib SOURCE_DIR ${CMAKE_BINARY_DIR}/src/protobuf-lib
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release
# LOG_CONFIGURE 1
# LOG_BUILD 1
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install
URL_MD5 fb59398329002c98d4d92238324c4187 URL_MD5 fb59398329002c98d4d92238324c4187
) )
@ -178,16 +178,12 @@ if (TARS_PROTOBUF)
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/protobuf-lib SOURCE_DIR ${CMAKE_BINARY_DIR}/src/protobuf-lib
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
BUILD_COMMAND make BUILD_COMMAND make
# LOG_CONFIGURE 1
# LOG_BUILD 1
# INSTALL_COMMAND ${CMAKE_COMMAND} -P ${RUN_PROTOBUF_INSTALL_FILE}
URL_MD5 fb59398329002c98d4d92238324c4187 URL_MD5 fb59398329002c98d4d92238324c4187
) )
endif () endif ()
INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/protobuf/ DESTINATION thirdparty) INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/protobuf/ DESTINATION thirdparty)
# INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/protobuf/include/google DESTINATION thirdparty/include)
add_dependencies(thirdparty ADD_${LIB_PROTOBUF}) add_dependencies(thirdparty ADD_${LIB_PROTOBUF})
@ -214,8 +210,6 @@ if (TARS_SSL)
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/openssl-lib SOURCE_DIR ${CMAKE_BINARY_DIR}/src/openssl-lib
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
BUILD_COMMAND nmake BUILD_COMMAND nmake
# LOG_CONFIGURE 1
# LOG_BUILD 1
INSTALL_COMMAND nmake install INSTALL_COMMAND nmake install
URL_MD5 3be209000dbc7e1b95bcdf47980a3baa URL_MD5 3be209000dbc7e1b95bcdf47980a3baa
) )
@ -232,16 +226,12 @@ if (TARS_SSL)
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/openssl-lib SOURCE_DIR ${CMAKE_BINARY_DIR}/src/openssl-lib
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
BUILD_COMMAND make BUILD_COMMAND make
# LOG_CONFIGURE 1
# LOG_BUILD 1
# INSTALL_COMMAND ${CMAKE_COMMAND} -P ${RUN_SSL_INSTALL_FILE}
URL_MD5 3be209000dbc7e1b95bcdf47980a3baa URL_MD5 3be209000dbc7e1b95bcdf47980a3baa
) )
endif () endif ()
INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/openssl/ DESTINATION thirdparty) INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/openssl/ DESTINATION thirdparty)
# INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/openssl/include/openssl DESTINATION thirdparty/include)
add_dependencies(thirdparty ADD_${LIB_SSL}) add_dependencies(thirdparty ADD_${LIB_SSL})
endif () endif ()
@ -264,8 +254,6 @@ if (TARS_MYSQL)
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/mysql-lib SOURCE_DIR ${CMAKE_BINARY_DIR}/src/mysql-lib
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release
# LOG_CONFIGURE 1
# LOG_BUILD 1
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install
URL_MD5 62de01beffc48348708c983a585b4dc1 URL_MD5 62de01beffc48348708c983a585b4dc1
) )
@ -282,9 +270,6 @@ if (TARS_MYSQL)
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/mysql-lib SOURCE_DIR ${CMAKE_BINARY_DIR}/src/mysql-lib
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
BUILD_COMMAND make mysqlclient BUILD_COMMAND make mysqlclient
# LOG_CONFIGURE 1
# LOG_BUILD 1
# INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install
URL_MD5 98ca2071f9d4c6b73146cc0455f6b914 URL_MD5 98ca2071f9d4c6b73146cc0455f6b914
) )
@ -317,8 +302,6 @@ if (TARS_HTTP2)
CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/nghttp2 -DENABLE_LIB_ONLY=ON -DENABLE_STATIC_LIB=ON CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/nghttp2 -DENABLE_LIB_ONLY=ON -DENABLE_STATIC_LIB=ON
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/nghttp2-lib SOURCE_DIR ${CMAKE_BINARY_DIR}/src/nghttp2-lib
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
# LOG_BUILD 1
# LOG_CONFIGURE 1
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release BUILD_COMMAND ${CMAKE_COMMAND} --build . --config release
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install INSTALL_COMMAND ${CMAKE_COMMAND} --build . --config release --target install
URL_MD5 5df375bbd532fcaa7cd4044b54b1188d URL_MD5 5df375bbd532fcaa7cd4044b54b1188d
@ -333,17 +316,13 @@ if (TARS_HTTP2)
CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/nghttp2 -DENABLE_LIB_ONLY=ON -DENABLE_STATIC_LIB=ON CONFIGURE_COMMAND ${CMAKE_COMMAND} . -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/src/nghttp2 -DENABLE_LIB_ONLY=ON -DENABLE_STATIC_LIB=ON
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/nghttp2-lib SOURCE_DIR ${CMAKE_BINARY_DIR}/src/nghttp2-lib
BUILD_IN_SOURCE 1 BUILD_IN_SOURCE 1
# LOG_BUILD 1
# LOG_CONFIGURE 1
BUILD_COMMAND make BUILD_COMMAND make
# INSTALL_COMMAND incmake --build . --config release --target install
URL_MD5 5df375bbd532fcaa7cd4044b54b1188d URL_MD5 5df375bbd532fcaa7cd4044b54b1188d
) )
endif () endif ()
INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/nghttp2/ DESTINATION thirdparty) INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/nghttp2/ DESTINATION thirdparty)
# INSTALL(DIRECTORY ${CMAKE_BINARY_DIR}/src/nghttp2/include/nghttp2 DESTINATION thirdparty/include)
add_dependencies(thirdparty ADD_${LIB_HTTP2}) add_dependencies(thirdparty ADD_${LIB_HTTP2})
@ -354,4 +333,4 @@ message("TARS_MYSQL: ${TARS_MYSQL}")
message("TARS_HTTP2: ${TARS_HTTP2}") message("TARS_HTTP2: ${TARS_HTTP2}")
message("TARS_SSL: ${TARS_SSL}") message("TARS_SSL: ${TARS_SSL}")
message("TARS_PROTOBUF: ${TARS_PROTOBUF}") message("TARS_PROTOBUF: ${TARS_PROTOBUF}")
message("TARS_GPERF: ${TARS_GPERF}")

View File

@ -1076,7 +1076,7 @@ void Application::initializeServer()
ServerConfig::CoroutineStackSize= (uint32_t)TC_Common::toSize(toDefault(_conf.get("/tars/application/server<coroutinestack>"), "128K"), 1024*128); ServerConfig::CoroutineStackSize= (uint32_t)TC_Common::toSize(toDefault(_conf.get("/tars/application/server<coroutinestack>"), "128K"), 1024*128);
ServerConfig::ManualListen = _conf.get("/tars/application/server<manuallisten>", "0") == "0" ? false : true; ServerConfig::ManualListen = _conf.get("/tars/application/server<manuallisten>", "0") == "0" ? false : true;
ServerConfig::MergeNetImp = _conf.get("/tars/application/server<mergenetimp>", "0") == "0" ? false : true; ServerConfig::MergeNetImp = _conf.get("/tars/application/server<mergenetimp>", "0") == "0" ? false : true;
ServerConfig::NetThread = TC_Common::strto<int>(toDefault(_conf.get("/tars/application/server<nethread>"), "1")); ServerConfig::NetThread = TC_Common::strto<int>(toDefault(_conf.get("/tars/application/server<netthread>"), "1"));
ServerConfig::CloseCout = _conf.get("/tars/application/server<closecout>","1")=="0"?0:1; ServerConfig::CloseCout = _conf.get("/tars/application/server<closecout>","1")=="0"?0:1;
ServerConfig::BackPacketLimit = TC_Common::strto<int>(_conf.get("/tars/application/server<backpacketlimit>", "100*1024*1024")); ServerConfig::BackPacketLimit = TC_Common::strto<int>(_conf.get("/tars/application/server<backpacketlimit>", "100*1024*1024"));
ServerConfig::BackPacketMin = TC_Common::strto<int>(_conf.get("/tars/application/server<backpacketmin>", "1024")); ServerConfig::BackPacketMin = TC_Common::strto<int>(_conf.get("/tars/application/server<backpacketmin>", "1024"));