From 5e5f32b085df30dab5470d69cc9441b26690e730 Mon Sep 17 00:00:00 2001 From: Jeff Tao Date: Fri, 27 Mar 2020 22:19:32 +0800 Subject: [PATCH] add the code to handle the broken link --- src/rpc/src/rpcMain.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/rpc/src/rpcMain.c b/src/rpc/src/rpcMain.c index 3b0137231f..9748f5d730 100755 --- a/src/rpc/src/rpcMain.c +++ b/src/rpc/src/rpcMain.c @@ -799,6 +799,18 @@ static void rpcProcessBrokenLink(SRpcConn *pConn) { pContext->code = TSDB_CODE_NETWORK_UNAVAIL; taosTmrStart(rpcProcessConnError, 0, pContext, pRpc->tmrCtrl); } + + if (pConn->inType) { + // if there are pending request, notify the app + tTrace("%s %p, connection is gone, notify the app", pRpc->label, pConn); + SRpcMsg rpcMsg; + rpcMsg.pCont = NULL; + rpcMsg.contLen = 0; + rpcMsg.handle = pConn; + rpcMsg.msgType = pConn->inType; + rpcMsg.code = TSDB_CODE_NETWORK_UNAVAIL; + (*(pRpc->cfp))(&rpcMsg); + } rpcCloseConn(pConn); } -- GitLab