Unverified 提交 45dfac41 authored 作者: José Luis Millán's avatar José Luis Millán 提交者: GitHub

SctpAssociation: increase sctpBufferedAmount before sending any data (#472)

Prevents increasing the value 'after' send_cb is called before returning
from usrsctp_sendv.
上级 304bce88
......@@ -425,20 +425,21 @@ namespace RTC
}
}
this->sctpBufferedAmount += len;
int ret = usrsctp_sendv(
this->socket, msg, len, nullptr, 0, &spa, static_cast<socklen_t>(sizeof(spa)), SCTP_SENDV_SPA, 0);
if (ret > 0)
{
// NOTE: 'usrsctp_sendv' returns the number of bytes sent.
// Don't decrese such value to sctpBufferedAmount since nothing is sent
// at this point.
this->sctpBufferedAmount += len;
this->listener->OnSctpAssociationBufferedAmount(this, this->sctpBufferedAmount);
}
if (ret < 0)
{
this->sctpBufferedAmount -= ret;
MS_WARN_TAG(
sctp,
"error sending SCTP message [sid:%" PRIu16 ", ppid:%" PRIu32 ", message size:%zu]: %s",
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论