Browse Source

Fixed max message size getter

Paul-Louis Ageneau 5 years ago
parent
commit
d4c5ef8155
1 changed files with 3 additions and 3 deletions
  1. 3 3
      src/datachannel.cpp

+ 3 - 3
src/datachannel.cpp

@@ -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(); }