diff --git a/include/os/os.h b/include/os/os.h index 935923195b3d2eba5da0d9f8df7af3c010dc3be2..d450ff620f57293716fe7fcbbc8768e8c35fb0e3 100644 --- a/include/os/os.h +++ b/include/os/os.h @@ -36,15 +36,6 @@ extern "C" { #include #include -// #include -// #include -// #include -// // #include -// -// #include -// #include -// #include - #include "osAtomic.h" #include "osDef.h" #include "osDir.h" @@ -52,12 +43,15 @@ extern "C" { #include "osFile.h" #include "osMath.h" #include "osMemory.h" +#include "osRand.h" #include "osSemaphore.h" +#include "osSignal.h" +#include "osSleep.h" #include "osSocket.h" #include "osString.h" -#include "osSleep.h" -#include "osTime.h" #include "osThread.h" +#include "osTime.h" +#include "osTimer.h" #ifdef __cplusplus } diff --git a/include/os/osAtomic.h b/include/os/osAtomic.h index 7affa444ee44c8c7e6de209f2b4ea23238c26d3b..bd3d372fc0cfb0138fc63b870c427179c4cac7db 100644 --- a/include/os/osAtomic.h +++ b/include/os/osAtomic.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_ATOMIC_H -#define TDENGINE_OS_ATOMIC_H +#ifndef _TD_OS_ATOMIC_H_ +#define _TD_OS_ATOMIC_H_ #ifdef __cplusplus extern "C" { @@ -355,4 +355,4 @@ extern "C" { } #endif -#endif +#endif /*_TD_OS_ATOMIC_H_*/ diff --git a/include/os/osDir.h b/include/os/osDir.h index 7afe1264512bbffd34d9278ffb37034a473b827f..dfd814d70b49a993fba53ec6ec20610ac0e619f9 100644 --- a/include/os/osDir.h +++ b/include/os/osDir.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_DIR_H -#define TDENGINE_OS_DIR_H +#ifndef _TD_OS_DIR_H_ +#define _TD_OS_DIR_H_ #ifdef __cplusplus extern "C" { @@ -31,4 +31,4 @@ int32_t taosCompressFile(char *srcFileName, char *destFileName); } #endif -#endif +#endif /*_TD_OS_DIR_H_*/ diff --git a/include/os/osRand.h b/include/os/osRand.h index e08768c2cc6b379877fb8be7d3541c13bc431f98..422ea92a71feabfae497e319879704af89bd655d 100644 --- a/include/os/osRand.h +++ b/include/os/osRand.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_RAND_H -#define TDENGINE_OS_RAND_H +#ifndef _TD_OS_RAND_H_ +#define _TD_OS_RAND_H_ #ifdef __cplusplus extern "C" { @@ -28,4 +28,4 @@ uint32_t taosSafeRand(void); } #endif -#endif +#endif /*_TD_OS_RAND_H_*/ diff --git a/include/os/osSemaphore.h b/include/os/osSemaphore.h index d945e721c2999c6c2cd1302e4befc22997db0af4..86a9f10819f11d54cd860bfbc01ebb6ba9d34129 100644 --- a/include/os/osSemaphore.h +++ b/include/os/osSemaphore.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_SEMAPHORE_H -#define TDENGINE_OS_SEMAPHORE_H +#ifndef _TD_OS_SEMPHONE_H_ +#define _TD_OS_SEMPHONE_H_ #ifdef __cplusplus extern "C" { @@ -63,4 +63,4 @@ int32_t taosGetCurrentAPPName(char* name, int32_t* len); } #endif -#endif +#endif /*_TD_OS_SEMPHONE_H_*/ diff --git a/include/os/osSignal.h b/include/os/osSignal.h new file mode 100644 index 0000000000000000000000000000000000000000..ce133e62b7bd2c4eb81e689309c82aa4de9f25d5 --- /dev/null +++ b/include/os/osSignal.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_OS_SIGNAL_H_ +#define _TD_OS_SIGNAL_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t taosInitTimer(void (*callback)(int32_t), int32_t ms); +void taosUninitTimer(); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_OS_SIGNAL_H_*/ diff --git a/include/os/osSocket.h b/include/os/osSocket.h index 0b183b9ece773b3bbc0b21d57146aa6aa2d6e88b..719c69376513fe351a8feb8c05ae1a48603297b0 100644 --- a/include/os/osSocket.h +++ b/include/os/osSocket.h @@ -30,6 +30,7 @@ extern "C" { #include #include #include + #include #include #endif diff --git a/include/os/osString.h b/include/os/osString.h index 33f858485c4291f7c7c9098685c8c70a02799fe6..3adee83c84ca979bd3f80921560fc8e0ad750367 100644 --- a/include/os/osString.h +++ b/include/os/osString.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_STRING_H -#define TDENGINE_OS_STRING_H +#ifndef _TD_OS_STRING_H_ +#define _TD_OS_STRING_H_ #ifdef __cplusplus extern "C" { @@ -51,4 +51,4 @@ char * taosCharsetReplace(char *charsetstr); } #endif -#endif +#endif /*_TD_OS_STRING_H_*/ diff --git a/include/os/osTime.h b/include/os/osTime.h index c5ee26e6eff365a0eb4512f24d9b904b5c0a03a4..d076d502766505ae5d44e3b126a411453eb81383 100644 --- a/include/os/osTime.h +++ b/include/os/osTime.h @@ -13,8 +13,8 @@ * along with this program. If not, see . */ -#ifndef TDENGINE_OS_TIME_H -#define TDENGINE_OS_TIME_H +#ifndef _TD_OS_TIME_H_ +#define _TD_OS_TIME_H_ #ifdef __cplusplus extern "C" { @@ -55,4 +55,4 @@ int64_t convertTimePrecision(int64_t time, int32_t fromPrecision, int32_t toPrec } #endif -#endif // TDENGINE_TTIME_H +#endif /*_TD_OS_TIME_H_*/ diff --git a/include/os/osTimer.h b/include/os/osTimer.h new file mode 100644 index 0000000000000000000000000000000000000000..623d2da20a3285e67adc12f5c9fccb1756e55e4b --- /dev/null +++ b/include/os/osTimer.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2019 TAOS Data, Inc. + * + * This program is free software: you can use, redistribute, and/or modify + * it under the terms of the GNU Affero General Public License, version 3 + * or later ("AGPL"), as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +#ifndef _TD_OS_TIMER_H_ +#define _TD_OS_TIMER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t taosInitTimer(void (*callback)(int32_t), int32_t ms); +void taosUninitTimer(); + +#ifdef __cplusplus +} +#endif + +#endif /*_TD_OS_TIMER_H_*/ diff --git a/source/libs/transport/src/rpcTcp.c b/source/libs/transport/src/rpcTcp.c index 5eb7e39ff20bd333aeca9df02fed6aa6fa087e56..1f657a5b8d3c4c79aac451af6e0372f8fbb4387e 100644 --- a/source/libs/transport/src/rpcTcp.c +++ b/source/libs/transport/src/rpcTcp.c @@ -22,9 +22,6 @@ #include "rpcHead.h" #include "rpcTcp.h" - -#include - typedef struct SFdObj { void *signature; SOCKET fd; // TCP socket FD