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

SctpAssociation: provide 'sctpsendbufferfull' reason on send error (#552)

DataConsumer.send(), fail with 'sctpsendbufferfull' error if that's the
error cause.
上级 3904da14
......@@ -13,7 +13,7 @@ namespace RTC
class DataConsumer
{
protected:
using onQueuedCallback = const std::function<void(bool queued)>;
using onQueuedCallback = const std::function<void(bool queued, bool sctpSendBufferFull)>;
public:
class Listener
......
......@@ -32,7 +32,7 @@ namespace RTC
};
protected:
using onQueuedCallback = const std::function<void(bool queued)>;
using onQueuedCallback = const std::function<void(bool queued, bool sctpSendBufferFull)>;
public:
class Listener
......
......@@ -48,7 +48,7 @@ namespace RTC
{
protected:
using onSendCallback = const std::function<void(bool sent)>;
using onQueuedCallback = const std::function<void(bool queued)>;
using onQueuedCallback = const std::function<void(bool queued, bool sctpSendBufferFull)>;
public:
class Listener
......
......@@ -222,11 +222,11 @@ namespace RTC
return;
}
const auto* cb = new onQueuedCallback([&request](bool queued) {
const auto* cb = new onQueuedCallback([&request](bool queued, bool sctpSendBufferFull) {
if (queued)
request->Accept();
else
request->Error("message send failed");
request->Error(sctpSendBufferFull == true ? "sctpsendbufferfull" : "message send failed");
});
SendMessage(ppid, msg, len, cb);
......
......@@ -446,22 +446,24 @@ namespace RTC
len,
std::strerror(errno));
bool sctpSendBufferFull = errno == EWOULDBLOCK || errno == EAGAIN;
if (cb)
{
(*cb)(false);
(*cb)(false, sctpSendBufferFull);
delete cb;
}
if (sctpSendBufferFull)
{
Channel::Notifier::Emit(dataConsumer->id, "sctpsendbufferfull");
}
}
else if (cb)
{
(*cb)(true);
(*cb)(true, false);
delete cb;
}
if (errno == EWOULDBLOCK || errno == EAGAIN)
{
Channel::Notifier::Emit(dataConsumer->id, "sctpsendbufferfull");
}
}
void SctpAssociation::HandleDataConsumer(RTC::DataConsumer* dataConsumer)
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论