mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-25 16:39:25 +00:00
Fixed DataChannel recv queue limit
This commit is contained in:
@ -43,10 +43,6 @@ using std::uint8_t;
|
|||||||
|
|
||||||
const size_t MAX_NUMERICNODE_LEN = 48; // Max IPv6 string representation length
|
const size_t MAX_NUMERICNODE_LEN = 48; // Max IPv6 string representation length
|
||||||
const size_t MAX_NUMERICSERV_LEN = 6; // Max port string representation length
|
const size_t MAX_NUMERICSERV_LEN = 6; // Max port string representation length
|
||||||
|
|
||||||
const size_t RECV_QUEUE_SIZE = 16; // DataChannel receive queue size in messages
|
|
||||||
// (0 means unlimited)
|
|
||||||
|
|
||||||
const uint16_t DEFAULT_SCTP_PORT = 5000; // SCTP port to use by default
|
const uint16_t DEFAULT_SCTP_PORT = 5000; // SCTP port to use by default
|
||||||
|
|
||||||
template <class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
|
template <class... Ts> struct overloaded : Ts... { using Ts::operator()...; };
|
||||||
|
@ -57,18 +57,20 @@ struct CloseMessage {
|
|||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
const size_t RECV_QUEUE_LIMIT = 1024 * 1024; // 1 MiB
|
||||||
|
|
||||||
DataChannel::DataChannel(shared_ptr<PeerConnection> pc, unsigned int stream, string label,
|
DataChannel::DataChannel(shared_ptr<PeerConnection> pc, unsigned int stream, string label,
|
||||||
string protocol, Reliability reliability)
|
string protocol, Reliability reliability)
|
||||||
: mPeerConnection(std::move(pc)), mStream(stream), mLabel(std::move(label)),
|
: mPeerConnection(std::move(pc)), mStream(stream), mLabel(std::move(label)),
|
||||||
mProtocol(std::move(protocol)),
|
mProtocol(std::move(protocol)),
|
||||||
mReliability(std::make_shared<Reliability>(std::move(reliability))),
|
mReliability(std::make_shared<Reliability>(std::move(reliability))),
|
||||||
mRecvQueue(RECV_QUEUE_SIZE, message_size_func) {}
|
mRecvQueue(RECV_QUEUE_LIMIT, message_size_func) {}
|
||||||
|
|
||||||
DataChannel::DataChannel(shared_ptr<PeerConnection> pc, shared_ptr<SctpTransport> transport,
|
DataChannel::DataChannel(shared_ptr<PeerConnection> pc, shared_ptr<SctpTransport> transport,
|
||||||
unsigned int stream)
|
unsigned int stream)
|
||||||
: mPeerConnection(std::move(pc)), mSctpTransport(transport), mStream(stream),
|
: mPeerConnection(std::move(pc)), mSctpTransport(transport), mStream(stream),
|
||||||
mReliability(std::make_shared<Reliability>()),
|
mReliability(std::make_shared<Reliability>()),
|
||||||
mRecvQueue(RECV_QUEUE_SIZE, message_size_func) {}
|
mRecvQueue(RECV_QUEUE_LIMIT, message_size_func) {}
|
||||||
|
|
||||||
DataChannel::~DataChannel() { close(); }
|
DataChannel::~DataChannel() { close(); }
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user