File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -2312,20 +2312,22 @@ uint32_t RTPSParticipantImpl::getMaxDataSize()
2312
2312
uint32_t RTPSParticipantImpl::calculateMaxDataSize (
2313
2313
uint32_t length)
2314
2314
{
2315
- uint32_t maxDataSize = length;
2316
-
2315
+ // RTPS header
2316
+ uint32_t overhead = RTPSMESSAGE_HEADER_SIZE;
2317
2317
#if HAVE_SECURITY
2318
2318
// If there is rtps messsage protection, reduce max size for messages,
2319
2319
// because extra data is added on encryption.
2320
2320
if (security_attributes_.is_rtps_protected )
2321
2321
{
2322
- maxDataSize - = m_security_manager.calculate_extra_size_for_rtps_message ();
2322
+ overhead + = m_security_manager.calculate_extra_size_for_rtps_message ();
2323
2323
}
2324
2324
#endif // if HAVE_SECURITY
2325
2325
2326
- // RTPS header
2327
- maxDataSize -= RTPSMESSAGE_HEADER_SIZE;
2328
- return maxDataSize;
2326
+ if (length <= overhead)
2327
+ {
2328
+ return 0 ;
2329
+ }
2330
+ return length - overhead;
2329
2331
}
2330
2332
2331
2333
bool RTPSParticipantImpl::networkFactoryHasRegisteredTransports () const
You can’t perform that action at this time.
0 commit comments