提交 5889ea12 编写于 作者: K kailixu

chore: support specify param by app

上级 ab9d95d1
...@@ -230,7 +230,7 @@ DLL_EXPORT int taos_get_tables_vgId(TAOS *taos, const char *db, const char *tabl ...@@ -230,7 +230,7 @@ DLL_EXPORT int taos_get_tables_vgId(TAOS *taos, const char *db, const char *tabl
DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList); DLL_EXPORT int taos_load_table_info(TAOS *taos, const char *tableNameList);
DLL_EXPORT int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t *fp, void *param); DLL_EXPORT int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t *fp, void *param, int type);
/* --------------------------schemaless INTERFACE------------------------------- */ /* --------------------------schemaless INTERFACE------------------------------- */
......
...@@ -135,6 +135,7 @@ typedef struct SAppInfo { ...@@ -135,6 +135,7 @@ typedef struct SAppInfo {
typedef struct { typedef struct {
int32_t ver; int32_t ver;
void* param;
__taos_notify_fn_t* fp; __taos_notify_fn_t* fp;
} SPassInfo; } SPassInfo;
......
...@@ -73,7 +73,7 @@ static int32_t hbProcessUserPassInfoRsp(void *value, int32_t valueLen, SClientHb ...@@ -73,7 +73,7 @@ static int32_t hbProcessUserPassInfoRsp(void *value, int32_t valueLen, SClientHb
if (atomic_load_32(&passInfo->ver) < rsp->version) { if (atomic_load_32(&passInfo->ver) < rsp->version) {
atomic_store_32(&passInfo->ver, rsp->version); atomic_store_32(&passInfo->ver, rsp->version);
if (passInfo->fp) { if (passInfo->fp) {
(*passInfo->fp)(&pTscObj->id, NULL, TAOS_NOTIFY_PASSVER); (*passInfo->fp)(&pTscObj->id, passInfo->param, TAOS_NOTIFY_PASSVER);
} }
} }
} }
......
...@@ -119,7 +119,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha ...@@ -119,7 +119,7 @@ TAOS *taos_connect(const char *ip, const char *user, const char *pass, const cha
return NULL; return NULL;
} }
int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t *fp, void *param) { int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t *fp, void *param, int type) {
if (taos == NULL) { if (taos == NULL) {
return TSDB_CODE_INVALID_PARA; return TSDB_CODE_INVALID_PARA;
} }
...@@ -130,10 +130,10 @@ int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t *fp, void *param) { ...@@ -130,10 +130,10 @@ int taos_set_notify_cb(TAOS *taos, __taos_notify_fn_t *fp, void *param) {
return TSDB_CODE_TSC_DISCONNECTED; return TSDB_CODE_TSC_DISCONNECTED;
} }
int32_t type = param ? *(int32_t *)param : 0;
switch (type) { switch (type) {
case TAOS_NOTIFY_PASSVER: { case TAOS_NOTIFY_PASSVER: {
pObj->passInfo.fp = fp; pObj->passInfo.fp = fp;
pObj->passInfo.param = param;
break; break;
} }
default: default:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册