From 5ebfedd56cc93906244fac9d98b7743f14f005c4 Mon Sep 17 00:00:00 2001 From: yihaoDeng Date: Thu, 7 Jul 2022 16:12:15 +0800 Subject: [PATCH] set msg resp type --- source/libs/transport/src/transSvr.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/source/libs/transport/src/transSvr.c b/source/libs/transport/src/transSvr.c index 21bb571978..db983a873c 100644 --- a/source/libs/transport/src/transSvr.c +++ b/source/libs/transport/src/transSvr.c @@ -391,12 +391,9 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) { pHead->traceId = pMsg->info.traceId; pHead->hasEpSet = pMsg->info.hasEpSet; + if (pConn->status == ConnNormal) { - if (0 == smsg->msg.msgType) { - pHead->msgType = pConn->inType + 1; - } else { - pHead->msgType = smsg->msg.msgType; - } + pHead->msgType = (0 == pMsg->msgType ? pConn->inType + 1 : pMsg->msgType); } else { if (smsg->type == Release) { pHead->msgType = 0; @@ -405,11 +402,8 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) { destroyConnRegArg(pConn); transUnrefSrvHandle(pConn); } else { - pHead->msgType = pMsg->msgType; // set up resp msg type - if (pHead->msgType == 0 && transMsgLenFromCont(pMsg->contLen) == sizeof(STransMsgHead)) { - pHead->msgType = pConn->inType + 1; - } + pHead->msgType = (0 == pMsg->msgType ? pConn->inType + 1 : pMsg->msgType); } }