enhance: enhance test case
This commit is contained in:
parent
7aa3bd92a2
commit
6dfb939f22
|
@ -876,14 +876,9 @@ typedef struct {
|
|||
int32_t tSerializeSDropUserReq(void* buf, int32_t bufLen, SDropUserReq* pReq);
|
||||
int32_t tDeserializeSDropUserReq(void* buf, int32_t bufLen, SDropUserReq* pReq);
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
uint64_t ip_mask;
|
||||
};
|
||||
struct {
|
||||
typedef struct SIpV4Range{
|
||||
uint32_t ip;
|
||||
uint32_t mask;
|
||||
};
|
||||
} SIpV4Range;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -178,8 +178,21 @@ int32_t fetchWhiteListCallbackFn(void* param, SDataBuf* pMsg, int32_t code) {
|
|||
SGetUserWhiteListRsp wlRsp;
|
||||
tDeserializeSGetUserWhiteListRsp(pMsg->pData, pMsg->len, &wlRsp);
|
||||
|
||||
pInfo->userCbFn(pInfo->userParam, code, taos, wlRsp.numWhiteLists, &wlRsp.pWhiteLists->ip_mask);
|
||||
uint64_t* pWhiteLists = taosMemoryMalloc(wlRsp.numWhiteLists * sizeof(uint64_t));
|
||||
if (pWhiteLists == NULL) {
|
||||
taosMemoryFree(pMsg->pData);
|
||||
taosMemoryFree(pMsg->pEpSet);
|
||||
taosMemoryFree(pInfo);
|
||||
tFreeSGetUserWhiteListRsp(&wlRsp);
|
||||
}
|
||||
|
||||
for (int i = 0; i < wlRsp.numWhiteLists; ++i) {
|
||||
pWhiteLists[i] = ((uint64_t)wlRsp.pWhiteLists[i].mask << 32) | wlRsp.pWhiteLists[i].ip;
|
||||
}
|
||||
|
||||
pInfo->userCbFn(pInfo->userParam, code, taos, wlRsp.numWhiteLists, pWhiteLists);
|
||||
|
||||
taosMemoryFree(pWhiteLists);
|
||||
taosMemoryFree(pMsg->pData);
|
||||
taosMemoryFree(pMsg->pEpSet);
|
||||
taosMemoryFree(pInfo);
|
||||
|
|
|
@ -64,7 +64,7 @@ void __taos_async_whitelist_cb(void *param, int code, TAOS *taos, int numOfWhite
|
|||
if (code == 0) {
|
||||
printf("fetch whitelist cb. user: %s numofWhitelist: %d\n", param ? (char*)param : NULL, numOfWhiteLists);
|
||||
for (int i = 0; i < numOfWhiteLists; ++i) {
|
||||
printf(" %d: %16x\n", i, pWhiteList[i]);
|
||||
printf(" %d: 0x%llx\n", i, pWhiteList[i]);
|
||||
}
|
||||
} else {
|
||||
printf("fetch whitelist cb error %d\n", code);
|
||||
|
@ -118,8 +118,11 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
createUsers(taos, argv[1]);
|
||||
|
||||
sleep(1);
|
||||
|
||||
while (nWhiteListVerNotified < 10) {
|
||||
printf("white list update notified %d times\n", nWhiteListVerNotified);
|
||||
sleep(1);
|
||||
}
|
||||
printf("succeed in getting white list nofication. %d times\n", nWhiteListVerNotified);
|
||||
dropUsers(taos);
|
||||
taos_close(taos);
|
||||
taos_cleanup();
|
||||
|
@ -163,4 +166,5 @@ void createUsers(TAOS *taos, const char *host) {
|
|||
|
||||
taos_fetch_whitelist_a(taosu[i], __taos_async_whitelist_cb, users[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue