enh(rpc): validate fqdn

This commit is contained in:
yihaoDeng 2022-05-06 14:42:06 +08:00
parent 78c617a9f1
commit 699c8a0461
3 changed files with 3 additions and 2 deletions

View File

@ -51,6 +51,7 @@ void* rpcOpen(const SRpcInit* pInit) {
ip = taosGetIpv4FromFqdn(pInit->localFqdn); ip = taosGetIpv4FromFqdn(pInit->localFqdn);
if (ip == 0xFFFFFFFF) { if (ip == 0xFFFFFFFF) {
tError("invalid fqdn: %s", pInit->localFqdn); tError("invalid fqdn: %s", pInit->localFqdn);
terrno = TSDB_CODE_RPC_FQDN_ERROR;
taosMemoryFree(pRpc); taosMemoryFree(pRpc);
return NULL; return NULL;
} }

View File

@ -841,7 +841,7 @@ void* transInitServer(uint32_t ip, uint32_t port, char* label, int numOfThreads,
} }
} }
if (false == taosValidIpAndPort(srv->ip, srv->port)) { if (false == taosValidIpAndPort(srv->ip, srv->port)) {
tError("failed to bind, reason: %s", strerror(errno)); tError("failed to bind, reason: %s", terrstr());
goto End; goto End;
} }
if (false == addHandleToAcceptloop(srv)) { if (false == addHandleToAcceptloop(srv)) {

View File

@ -127,7 +127,7 @@ static void shellWorkAsServer() {
void *serverRpc = rpcOpen(&rpcInit); void *serverRpc = rpcOpen(&rpcInit);
if (serverRpc == NULL) { if (serverRpc == NULL) {
printf("failed to init net test server since %s", terrstr()); printf("failed to init net test server since %s\n", terrstr());
} else { } else {
printf("network test server is initialized, port:%u\n", pArgs->port); printf("network test server is initialized, port:%u\n", pArgs->port);
taosSetSignal(SIGTERM, shellNettestHandler); taosSetSignal(SIGTERM, shellNettestHandler);