early-access version 2853

This commit is contained in:
pineappleEA
2022-07-23 03:01:36 +02:00
parent 1f2b5081b5
commit 1f111bb69c
8955 changed files with 418777 additions and 999 deletions

View File

@@ -0,0 +1,112 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7872fc8..2a06614 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,7 +47,11 @@ string (REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")
if (UNIX)
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -ggdb -D_DEBUG -DGOOGLE_STRIP_LOG=0")
SET(CMAKE_CXX_FLAGS_RELEASE "-O3 -g -ggdb -DNDEBUG -DGOOGLE_STRIP_LOG=1")
- SET(DEPENDENT_LIBRARIES event glog pthread)
+ find_package(glog CONFIG REQUIRED)
+ find_path(GLOG_INCLUDE_DIRS logging.h PATH_SUFFIXES glog)
+ find_package(Libevent CONFIG REQUIRED)
+ list(APPEND DEPENDENT_INCLUDE_DIRS "${GLOG_INCLUDE_DIRS}/../")
+ SET(DEPENDENT_LIBRARIES libevent::core libevent::extra libevent::openssl glog::glog pthread)
else (UNIX)
SET(DEPENDENT_LIBRARIES event glog)
endif (UNIX)
diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt
index 469ed1c..8219424 100644
--- a/apps/CMakeLists.txt
+++ b/apps/CMakeLists.txt
@@ -2,7 +2,7 @@
include_directories(${PROJECT_SOURCE_DIR}/apps ${PROJECT_SOURCE_DIR}/3rdparty)
if (UNIX)
-set(LIBRARIES evpp_concurrentqueue event glog pthread)
+set(LIBRARIES evpp_concurrentqueue libevent::core libevent::extra libevent::openssl glog::glog pthread)
link_directories("/home/s/safe/lib" ${PROJECT_BUILD_DIR}/lib)
else(UNIX)
set(LIBRARIES evpp_static event glog)
diff --git a/benchmark/http/libevent/CMakeLists.txt b/benchmark/http/libevent/CMakeLists.txt
index 1148616..0356b71 100644
--- a/benchmark/http/libevent/CMakeLists.txt
+++ b/benchmark/http/libevent/CMakeLists.txt
@@ -1,3 +1,3 @@
add_executable(benchmark_http_libevent libevent_http_bench.c)
-target_link_libraries(benchmark_http_libevent event)
+target_link_libraries(benchmark_http_libevent libevent::core libevent::extra libevent::openssl)
diff --git a/benchmark/ioevent/libevent/CMakeLists.txt b/benchmark/ioevent/libevent/CMakeLists.txt
index dfa51a3..de4849d 100644
--- a/benchmark/ioevent/libevent/CMakeLists.txt
+++ b/benchmark/ioevent/libevent/CMakeLists.txt
@@ -1,3 +1,3 @@
add_executable(benchmark_ioevent_libevent libevent_ioevent_bench.c)
-target_link_libraries(benchmark_ioevent_libevent event)
+target_link_libraries(benchmark_ioevent_libevent libevent::core libevent::extra libevent::openssl)
diff --git a/benchmark/throughput/libevent/CMakeLists.txt b/benchmark/throughput/libevent/CMakeLists.txt
index 21dab84..aefe698 100644
--- a/benchmark/throughput/libevent/CMakeLists.txt
+++ b/benchmark/throughput/libevent/CMakeLists.txt
@@ -1,5 +1,5 @@
add_executable(benchmark_tcp_libevent_client client.c)
-target_link_libraries(benchmark_tcp_libevent_client event)
+target_link_libraries(benchmark_tcp_libevent_client libevent::core libevent::extra libevent::openssl)
add_executable(benchmark_tcp_libevent_server server.c)
-target_link_libraries(benchmark_tcp_libevent_server event)
+target_link_libraries(benchmark_tcp_libevent_server libevent::core libevent::extra libevent::openssl)
diff --git a/examples/recipes/self_control_timer/basic_01/CMakeLists.txt b/examples/recipes/self_control_timer/basic_01/CMakeLists.txt
index 7834db4..82294c5 100644
--- a/examples/recipes/self_control_timer/basic_01/CMakeLists.txt
+++ b/examples/recipes/self_control_timer/basic_01/CMakeLists.txt
@@ -1,7 +1,7 @@
file(GLOB SRCS *.cc *.h)
add_executable(example_recipes_self_control_timer_basic_01 ${SRCS})
-target_link_libraries(example_recipes_self_control_timer_basic_01 event)
+target_link_libraries(example_recipes_self_control_timer_basic_01 libevent::core libevent::extra libevent::openssl)
diff --git a/examples/recipes/self_control_timer/basic_02/CMakeLists.txt b/examples/recipes/self_control_timer/basic_02/CMakeLists.txt
index a8be419..0329ccc 100644
--- a/examples/recipes/self_control_timer/basic_02/CMakeLists.txt
+++ b/examples/recipes/self_control_timer/basic_02/CMakeLists.txt
@@ -1,7 +1,7 @@
file(GLOB SRCS *.cc *.h)
add_executable(example_recipes_self_control_timer_basic_02 ${SRCS})
-target_link_libraries(example_recipes_self_control_timer_basic_02 event)
+target_link_libraries(example_recipes_self_control_timer_basic_02 libevent::core libevent::extra libevent::openssl)
diff --git a/examples/recipes/self_control_timer/cancel_03/CMakeLists.txt b/examples/recipes/self_control_timer/cancel_03/CMakeLists.txt
index 1cae9bb..218b771 100644
--- a/examples/recipes/self_control_timer/cancel_03/CMakeLists.txt
+++ b/examples/recipes/self_control_timer/cancel_03/CMakeLists.txt
@@ -1,7 +1,7 @@
file(GLOB SRCS *.cc *.h)
add_executable(example_recipes_self_control_timer_cancel_03 ${SRCS})
-target_link_libraries(example_recipes_self_control_timer_cancel_03 event)
+target_link_libraries(example_recipes_self_control_timer_cancel_03 libevent::core libevent::extra libevent::openssl)
diff --git a/examples/recipes/self_control_timer/periodic_04/CMakeLists.txt b/examples/recipes/self_control_timer/periodic_04/CMakeLists.txt
index 749c584..e7c658e 100644
--- a/examples/recipes/self_control_timer/periodic_04/CMakeLists.txt
+++ b/examples/recipes/self_control_timer/periodic_04/CMakeLists.txt
@@ -1,7 +1,7 @@
file(GLOB SRCS *.cc *.h)
add_executable(example_recipes_self_control_timer_periodic_04 ${SRCS})
-target_link_libraries(example_recipes_self_control_timer_periodic_04 event)
+target_link_libraries(example_recipes_self_control_timer_periodic_04 libevent::core libevent::extra libevent::openssl)

View File

@@ -0,0 +1,45 @@
diff --git a/evpp/server_status.h b/evpp/server_status.h
index 3a83725..f28f833 100644
--- a/evpp/server_status.h
+++ b/evpp/server_status.h
@@ -25,7 +25,7 @@ public:
};
std::string StatusToString() const {
- H_CASE_STRING_BIGIN(status_);
+ H_CASE_STRING_BIGIN(+status_);
H_CASE_STRING(kNull);
H_CASE_STRING(kInitialized);
H_CASE_STRING(kRunning);
diff --git a/evpp/sockets.cc b/evpp/sockets.cc
index 333c05c..c547d88 100644
--- a/evpp/sockets.cc
+++ b/evpp/sockets.cc
@@ -22,6 +22,14 @@ std::string strerror(int e) {
}
return empty_string;
+#elif defined(__APPLE__)
+ char buf[2048] = {};
+ strerror_r(e, buf, sizeof(buf) - 1);
+ const char* s = buf;
+ if (s) {
+ return std::string(s);
+ }
+ return std::string();
#else
char buf[2048] = {};
const char* s = strerror_r(e, buf, sizeof(buf) - 1);
diff --git a/evpp/tcp_conn.cc b/evpp/tcp_conn.cc
index b7678d0..527b2b9 100644
--- a/evpp/tcp_conn.cc
+++ b/evpp/tcp_conn.cc
@@ -309,7 +309,7 @@ void TCPConn::SetTCPNoDelay(bool on) {
}
std::string TCPConn::StatusToString() const {
- H_CASE_STRING_BIGIN(status_);
+ H_CASE_STRING_BIGIN(+status_);
H_CASE_STRING(kDisconnected);
H_CASE_STRING(kConnecting);
H_CASE_STRING(kConnected);

View File

@@ -0,0 +1,159 @@
diff --git a/3rdparty/libhashkit/crc32.c b/3rdparty/libhashkit/crc32.c
index 6db0478..ff34194 100644
--- a/3rdparty/libhashkit/crc32.c
+++ b/3rdparty/libhashkit/crc32.c
@@ -73,7 +73,7 @@ static const uint32_t crc32tab[256] = {
0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,
};
-uint32_t hashkit_crc32(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_crc32(const char *key, size_t key_length, void * context)
{
uint64_t x;
uint32_t crc= UINT32_MAX;
diff --git a/3rdparty/libhashkit/fnv.c b/3rdparty/libhashkit/fnv.c
index ee3754d..d79fe39 100644
--- a/3rdparty/libhashkit/fnv.c
+++ b/3rdparty/libhashkit/fnv.c
@@ -14,7 +14,7 @@ static uint64_t FNV_64_PRIME= UINT64_C(0x100000001b3);
static uint32_t FNV_32_INIT= 2166136261UL;
static uint32_t FNV_32_PRIME= 16777619;
-uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void * context)
{
/* Thanks to pierre@demartines.com for the pointer */
uint64_t hash= FNV_64_INIT;
@@ -28,7 +28,7 @@ uint32_t hashkit_fnv1_64(const char *key, size_t key_length, void *context __att
return (uint32_t)hash;
}
-uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void * context)
{
uint32_t hash= (uint32_t) FNV_64_INIT;
@@ -42,7 +42,7 @@ uint32_t hashkit_fnv1a_64(const char *key, size_t key_length, void *context __at
return hash;
}
-uint32_t hashkit_fnv1_32(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_fnv1_32(const char *key, size_t key_length, void * context)
{
uint32_t hash= FNV_32_INIT;
@@ -56,7 +56,7 @@ uint32_t hashkit_fnv1_32(const char *key, size_t key_length, void *context __att
return hash;
}
-uint32_t hashkit_fnv1a_32(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_fnv1a_32(const char *key, size_t key_length, void * context)
{
uint32_t hash= FNV_32_INIT;
diff --git a/3rdparty/libhashkit/hsieh.c b/3rdparty/libhashkit/hsieh.c
index ba46ed2..c3e9a38 100644
--- a/3rdparty/libhashkit/hsieh.c
+++ b/3rdparty/libhashkit/hsieh.c
@@ -17,7 +17,7 @@
+(uint32_t)(((const uint8_t *)(d))[0]) )
#endif
-uint32_t hashkit_hsieh(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_hsieh(const char *key, size_t key_length, void * context)
{
uint32_t hash = 0, tmp;
int rem;
diff --git a/3rdparty/libhashkit/jenkins.c b/3rdparty/libhashkit/jenkins.c
index b684d7a..2b59714 100644
--- a/3rdparty/libhashkit/jenkins.c
+++ b/3rdparty/libhashkit/jenkins.c
@@ -56,7 +56,7 @@ use a bitmask. For example, if you need only 10 bits, do
In which case, the hash table should have hashsize(10) elements.
*/
-uint32_t hashkit_jenkins(const char *key, size_t length, void *context __attribute__((unused)))
+uint32_t hashkit_jenkins(const char *key, size_t length, void * context)
{
uint32_t a,b,c; /* internal state */
union { const void *ptr; size_t i; } u; /* needed for Mac Powerbook G4 */
diff --git a/3rdparty/libhashkit/md5.c b/3rdparty/libhashkit/md5.c
index 7371c6d..0e3181b 100644
--- a/3rdparty/libhashkit/md5.c
+++ b/3rdparty/libhashkit/md5.c
@@ -352,7 +352,7 @@ unsigned int len)
(((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24);
}
-uint32_t hashkit_md5(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_md5(const char *key, size_t key_length, void * context)
{
unsigned char results[16];
diff --git a/3rdparty/libhashkit/murmur.c b/3rdparty/libhashkit/murmur.c
index a18ac40..9e55eec 100644
--- a/3rdparty/libhashkit/murmur.c
+++ b/3rdparty/libhashkit/murmur.c
@@ -17,7 +17,7 @@
#include "common.h"
-uint32_t hashkit_murmur(const char *key, size_t length, void *context __attribute__((unused)))
+uint32_t hashkit_murmur(const char *key, size_t length, void * context)
{
/*
'm' and 'r' are mixing constants generated offline. They're not
diff --git a/3rdparty/libhashkit/one_at_a_time.c b/3rdparty/libhashkit/one_at_a_time.c
index 579d044..539861c 100644
--- a/3rdparty/libhashkit/one_at_a_time.c
+++ b/3rdparty/libhashkit/one_at_a_time.c
@@ -13,7 +13,7 @@ http://en.wikipedia.org/wiki/Jenkins_hash_function
#include "common.h"
-uint32_t hashkit_one_at_a_time(const char *key, size_t key_length, void *context __attribute__((unused)))
+uint32_t hashkit_one_at_a_time(const char *key, size_t key_length, void * context)
{
const char *ptr= key;
uint32_t value= 0;
diff --git a/3rdparty/libhashkit/strerror.c b/3rdparty/libhashkit/strerror.c
index 270fa21..7446782 100644
--- a/3rdparty/libhashkit/strerror.c
+++ b/3rdparty/libhashkit/strerror.c
@@ -8,7 +8,7 @@
#include "common.h"
-const char *hashkit_strerror(hashkit_st *ptr __attribute__((unused)), hashkit_return_t rc)
+const char *hashkit_strerror(hashkit_st *ptr, hashkit_return_t rc)
{
switch (rc)
{
diff --git a/apps/evnsq/option.cc b/apps/evnsq/option.cc
index e2128f5..0248ace 100644
--- a/apps/evnsq/option.cc
+++ b/apps/evnsq/option.cc
@@ -21,14 +21,14 @@ std::string Option::ToJSON() const {
doc.AddMember("write_timeout", rapidjson::Value(int64_t(write_timeout.Milliseconds())), doc.GetAllocator());
doc.AddMember("msg_timeout", rapidjson::Value(int64_t(msg_timeout.Milliseconds())), doc.GetAllocator());
- doc.AddMember("client_id", rapidjson::Value(client_id, doc.GetAllocator()), doc.GetAllocator());
- doc.AddMember("hostname", rapidjson::Value(hostname, doc.GetAllocator()), doc.GetAllocator());
- doc.AddMember("user_agent", rapidjson::Value(user_agent, doc.GetAllocator()), doc.GetAllocator());
+ doc.AddMember("client_id", rapidjson::Value(client_id.data(), client_id.size(), doc.GetAllocator()), doc.GetAllocator());
+ doc.AddMember("hostname", rapidjson::Value(hostname.data(), hostname.size(), doc.GetAllocator()), doc.GetAllocator());
+ doc.AddMember("user_agent", rapidjson::Value(user_agent.data(), user_agent.size(), doc.GetAllocator()), doc.GetAllocator());
doc.AddMember("heartbeat_interval", rapidjson::Value(int64_t(heartbeat_interval.Milliseconds())), doc.GetAllocator());
doc.AddMember("deflate", rapidjson::Value(false), doc.GetAllocator());
- doc.AddMember("long_id", rapidjson::Value(hostname, doc.GetAllocator()), doc.GetAllocator());
+ doc.AddMember("long_id", rapidjson::Value(hostname.data(), hostname.size(), doc.GetAllocator()), doc.GetAllocator());
doc.AddMember("output_buffer_size", rapidjson::Value(int64_t(16384)), doc.GetAllocator());
doc.AddMember("output_buffer_timeout", rapidjson::Value(int64_t(250)), doc.GetAllocator());
doc.AddMember("feature_negotiation", rapidjson::Value(feature_negotiation), doc.GetAllocator());
@@ -40,3 +40,4 @@ std::string Option::ToJSON() const {
return std::string(buffer.GetString(), buffer.GetSize());
}
}
+

29
externals/vcpkg/ports/evpp/portfile.cmake vendored Executable file
View File

@@ -0,0 +1,29 @@
set(EVPP_VERSION 0.7.0)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Qihoo360/evpp
REF v${EVPP_VERSION}
SHA512 ddcef8d2af6b3c46473d755c0f0994d63d56240ea85d6b44ceb6b77724c3c56bbf1156f7188e270fb5f9f36f25bfc2f96669d7249a34c921922671e3fe267e88
HEAD_REF master
PATCHES
fix-rapidjson-1-1.patch
fix-linux-build.patch
fix-osx-build.patch
)
file(REMOVE_RECURSE ${SOURCE_PATH}/3rdparty/rapidjson ${SOURCE_PATH}/3rdparty/concurrentqueue)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DEVPP_VCPKG_BUILD=ON
)
vcpkg_install_cmake()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)

30
externals/vcpkg/ports/evpp/vcpkg.json vendored Executable file
View File

@@ -0,0 +1,30 @@
{
"name": "evpp",
"version-string": "0.7.0",
"port-version": 5,
"description": "A modern C++ network library based on libevent for developing high performance network services in TCP/UDP/HTTP protocols.",
"homepage": "https://github.com/Qihoo360/evpp",
"dependencies": [
{
"name": "boost-lockfree",
"platform": "!windows"
},
{
"name": "concurrentqueue",
"platform": "!windows"
},
"glog",
{
"name": "libevent",
"platform": "windows"
},
{
"name": "libevent",
"features": [
"openssl"
],
"platform": "!windows"
},
"rapidjson"
]
}