fix(rpc): close cmdSock on error
This commit is contained in:
parent
6371f83b87
commit
ba8865d348
@ -310,11 +310,15 @@ void RpcServer::run_rpc_server()
|
|||||||
|
|
||||||
if ((rv = nng_listen(cmdSock, url.c_str(), nullptr, 0)) != 0) {
|
if ((rv = nng_listen(cmdSock, url.c_str(), nullptr, 0)) != 0) {
|
||||||
LOG_ERROR("nng_listen error: {}", nng_strerror(rv));
|
LOG_ERROR("nng_listen error: {}", nng_strerror(rv));
|
||||||
|
nng_close(cmdSock);
|
||||||
|
nng_fini();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rv = nng_setopt_ms(cmdSock, NNG_OPT_SENDTIMEO, 1000)) != 0) {
|
if ((rv = nng_setopt_ms(cmdSock, NNG_OPT_SENDTIMEO, 1000)) != 0) {
|
||||||
LOG_ERROR("nng_setopt_ms error: {}", nng_strerror(rv));
|
LOG_ERROR("nng_setopt_ms error: {}", nng_strerror(rv));
|
||||||
|
nng_close(cmdSock);
|
||||||
|
nng_fini();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user