fix(rpc): avoid invalid write of sync api
This commit is contained in:
parent
13b42a00fa
commit
9c02b1b273
|
@ -949,9 +949,14 @@ int cliAppCb(SCliConn* pConn, STransMsg* pResp, SCliMsg* pMsg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pCtx->pSem != NULL) {
|
if (pCtx->pSem != NULL) {
|
||||||
tTrace("%s cli conn %p handle resp", pTransInst->label, pConn);
|
tTrace("%s cli conn %p(sync) handle resp", pTransInst->label, pConn);
|
||||||
|
if (pCtx->pRsp == NULL) {
|
||||||
|
tTrace("%s cli conn %p(sync) failed to resp, ignore", pTransInst->label, pConn);
|
||||||
|
} else {
|
||||||
memcpy((char*)pCtx->pRsp, (char*)pResp, sizeof(*pResp));
|
memcpy((char*)pCtx->pRsp, (char*)pResp, sizeof(*pResp));
|
||||||
|
}
|
||||||
tsem_post(pCtx->pSem);
|
tsem_post(pCtx->pSem);
|
||||||
|
pCtx->pRsp = NULL;
|
||||||
} else {
|
} else {
|
||||||
tTrace("%s cli conn %p handle resp", pTransInst->label, pConn);
|
tTrace("%s cli conn %p handle resp", pTransInst->label, pConn);
|
||||||
pTransInst->cfp(pTransInst->parent, pResp, pEpSet);
|
pTransInst->cfp(pTransInst->parent, pResp, pEpSet);
|
||||||
|
|
Loading…
Reference in New Issue