Skip to content

Commit 3c1e4ea

Browse files
committed
fixed:dtls judgment fails sometimes
1 parent bc8d0fd commit 3c1e4ea

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PullStream/PullStream_ClientWebRtc.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
bool PullStream_ClientProtocol_Dtls(LPCXSTR lpszMSGBuffer, int nMSGLen)
1414
{
1515
// DTLS有可能以多种不同的记录层类型开头,这里检查它是否是handshake(0x16)
16-
return nMSGLen >= 13 && lpszMSGBuffer[0] == 0x16;
16+
return ((nMSGLen >= 13) && (lpszMSGBuffer[0] == 0x16));
1717
}
1818
bool PullStream_ClientProtocol_Stun(LPCXSTR lpszMSGBuffer, int nMSGLen)
1919
{
@@ -74,10 +74,9 @@ bool PullStream_ClientProtocol_Handle(LPCXSTR lpszClientAddr, XSOCKET hSocket, L
7474
NatProtocol_StunNat_BuildMapAddress(tszRVBuffer + nRVLen, &nRVLen, tszIPPort, nPort, true);
7575
nSDLen = nRVLen;
7676
NatProtocol_StunNat_Packet(tszSDBuffer, &nSDLen, (LPCXSTR)st_NatClient.byTokenStr, RFCCOMPONENTS_NATCLIENT_PROTOCOL_STUN_CLASS_RESPONSE, RFCCOMPONENTS_NATCLIENT_PROTOCOL_STUN_ATTR_MAPPED_ADDRESS, tszRVBuffer);
77-
//消息效验需要加上4个属性头大小
77+
//消息效验需要加上24个属性头大小
7878
NatProtocol_StunNat_Resize(tszSDBuffer, 24);
7979
NatProtocol_StunNat_BuildMSGIntegrity(tszSDBuffer + nSDLen, &nSDLen, tszSDBuffer, nSDLen, st_ServiceConfig.st_XPull.st_PullWebRtc.tszICEPass);
80-
//NatProtocol_StunNat_Resize(tszSDBuffer, 20); //消息大小
8180

8281
nSDLen += 8; //加上Finger的大小
8382
NatProtocol_StunNat_Resize(tszSDBuffer, nSDLen - 20, 2); //减去头大小20是固定头大小

0 commit comments

Comments
 (0)