mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 15:15:28 +00:00
Fixed max message size getter
This commit is contained in:
@ -154,13 +154,13 @@ bool DataChannel::isOpen(void) const { return mIsOpen; }
|
||||
bool DataChannel::isClosed(void) const { return mIsClosed; }
|
||||
|
||||
size_t DataChannel::maxMessageSize() const {
|
||||
size_t max = DEFAULT_MAX_MESSAGE_SIZE;
|
||||
size_t remoteMax = DEFAULT_MAX_MESSAGE_SIZE;
|
||||
if (auto pc = mPeerConnection.lock())
|
||||
if (auto description = pc->remoteDescription())
|
||||
if (auto maxMessageSize = description->maxMessageSize())
|
||||
return *maxMessageSize > 0 ? *maxMessageSize : LOCAL_MAX_MESSAGE_SIZE;
|
||||
remoteMax = *maxMessageSize > 0 ? *maxMessageSize : LOCAL_MAX_MESSAGE_SIZE;
|
||||
|
||||
return std::min(max, LOCAL_MAX_MESSAGE_SIZE);
|
||||
return std::min(remoteMax, LOCAL_MAX_MESSAGE_SIZE);
|
||||
}
|
||||
|
||||
size_t DataChannel::availableAmount() const { return mRecvQueue.amount(); }
|
||||
|
Reference in New Issue
Block a user