diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed149da6ff..6c9f90b71b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -62,8 +62,10 @@ jobs: copyback: false prepare: | pkg update -f - pkg install -y cmake gmake gcc pkgconf openssl + pkg install -y cmake gmake gcc pkgconf openssl devel/googletest + pkg install -y snappy zstd liblz4 run: | freebsd-version - gmake - gmake tutorial + gmake KAFKA=y + gmake check KAFKA=y + gmake tutorial KAFKA=y diff --git a/src/kernel/poller.c b/src/kernel/poller.c index 981af002a5..4d5db41c50 100644 --- a/src/kernel/poller.c +++ b/src/kernel/poller.c @@ -231,15 +231,17 @@ static int __poller_set_timerfd(int fd, const struct timespec *abstime, if (abstime->tv_sec || abstime->tv_nsec) { + flags = EV_ADD; clock_gettime(CLOCK_MONOTONIC, &curtime); nseconds = 1000000000LL * (abstime->tv_sec - curtime.tv_sec); nseconds += abstime->tv_nsec - curtime.tv_nsec; - flags = EV_ADD; + if (nseconds < 0) + nseconds = 0; } else { - nseconds = 0; flags = EV_DELETE; + nseconds = 0; } EV_SET(&ev, fd, EVFILT_TIMER, flags, NOTE_NSECONDS, nseconds, NULL); diff --git a/src/protocol/kafka_parser.c b/src/protocol/kafka_parser.c index ce25245940..58f1ede7dc 100644 --- a/src/protocol/kafka_parser.c +++ b/src/protocol/kafka_parser.c @@ -16,6 +16,7 @@ Authors: Wang Zhulei (wangzhulei@sogou-inc.com) */ +#include #include #include #include diff --git a/src/protocol/kafka_parser.h b/src/protocol/kafka_parser.h index df613d4cf3..4a944b60bb 100644 --- a/src/protocol/kafka_parser.h +++ b/src/protocol/kafka_parser.h @@ -19,7 +19,7 @@ #ifndef _KAFKA_PARSER_H_ #define _KAFKA_PARSER_H_ -#include +#include #include #include #include "list.h" diff --git a/tutorial/CMakeLists.txt b/tutorial/CMakeLists.txt index 8cb06e58b0..c26e7caa6c 100644 --- a/tutorial/CMakeLists.txt +++ b/tutorial/CMakeLists.txt @@ -107,9 +107,26 @@ endif() if (KAFKA STREQUAL "y") add_executable("kafka_cli" "tutorial-13-kafka_cli.cc") find_package(ZLIB REQUIRED) + find_path(SNAPPY_INCLUDE_PATH NAMES snappy.h) find_library(SNAPPY_LIB NAMES snappy) - find_library(LZ4_LIB NAMES lz4) + if ((NOT SNAPPY_INCLUDE_PATH) OR (NOT SNAPPY_LIB)) + message(FATAL_ERROR "Fail to find snappy with KAFKA=y") + endif () + include_directories(${SNAPPY_INCLUDE_PATH}) + + find_path(ZSTD_INCLUDE_PATH NAMES zstd.h) find_library(ZSTD_LIB NAMES zstd) + if ((NOT ZSTD_INCLUDE_PATH) OR (NOT ZSTD_LIB)) + message(FATAL_ERROR "Fail to find zstd with KAFKA=y") + endif () + include_directories(${ZSTD_INCLUDE_PATH}) + + find_path(LZ4_INCLUDE_PATH NAMES lz4.h) + find_library(LZ4_LIB NAMES lz4) + if ((NOT LZ4_INCLUDE_PATH) OR (NOT LZ4_LIB)) + message(FATAL_ERROR "Fail to find lz4 with KAFKA=y") + endif () + include_directories(${LZ4_INCLUDE_PATH}) target_link_libraries("kafka_cli" ${WFKAFKA_LIB} ${LIB} ZLIB::ZLIB ${SNAPPY_LIB} ${LZ4_LIB} ${ZSTD_LIB}) endif ()