diff --git a/src/inc/trpc.h b/src/inc/trpc.h index 3be304e29b1b147b75230a58177df26fd7bc8c97..748fad0e6292464929421fb941ab1a83f5f3e763 100644 --- a/src/inc/trpc.h +++ b/src/inc/trpc.h @@ -83,7 +83,7 @@ void rpcSendResponse(const SRpcMsg *pMsg); void rpcSendRedirectRsp(void *pConn, const SRpcIpSet *pIpSet); int rpcGetConnInfo(void *thandle, SRpcConnInfo *pInfo); void rpcSendRecv(void *shandle, SRpcIpSet *pIpSet, const SRpcMsg *pReq, SRpcMsg *pRsp); -void rpcReportProgress(void *pConn, char *pCont, int contLen); +int rpcReportProgress(void *pConn, char *pCont, int contLen); #ifdef __cplusplus } diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 7627a06c994d155309be6dfd7d2e6e919acc7664..cf15cc690ab52b9fb538fd4809b26774aed06e75 100644 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -486,12 +486,19 @@ void rpcSendRecv(void *shandle, SRpcIpSet *pIpSet, const SRpcMsg *pMsg, SRpcMsg } // this API is used by server app to keep an APP context in case connection is broken -void rpcReportProgress(void *handle, char *pCont, int contLen) { +int rpcReportProgress(void *handle, char *pCont, int contLen) { SRpcConn *pConn = (SRpcConn *)handle; - // pReqMsg and reqMsgLen is re-used to store the context from app server - pConn->pReqMsg = pCont; - pConn->reqMsgLen = contLen; + if (pConn->user[0]) { + // pReqMsg and reqMsgLen is re-used to store the context from app server + pConn->pReqMsg = pCont; + pConn->reqMsgLen = contLen; + return 0; + } + + tTrace("%s, rpc connection is already released", pConn->info); + rpcFreeCont(pCont); + return -1; } static void rpcFreeMsg(void *msg) {