-
Notifications
You must be signed in to change notification settings - Fork 208
IPv6/Multi: Reduced complexity FreeRTOS_TCP_WIN.c #280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPv6/Multi: Reduced complexity FreeRTOS_TCP_WIN.c #280
Conversation
FreeRTOS_TCP_WIN.c
Outdated
| /* if( ( ipconfigTCP_MAY_LOG_PORT( pxWindow->usOurPortNumber ) ) && */ | ||
| /* ( ( xTCPWindowLoggingLevel >= 3 ) || */ | ||
| /* ( ( xTCPWindowLoggingLevel >= 2 ) && ( pxWindow->pxHeadSegment != NULL ) ) ) ) */ | ||
| /* { */ | ||
| /* FreeRTOS_debug_printf( ( "lTCPWindowTxAdd: New %4ld bytes for seqNr %lu len %4lu (nxt %lu) pos %lu\n", */ | ||
| /* ulLength, */ | ||
| /* pxSegment->ulSequenceNumber - pxWindow->tx.ulFirstSequenceNumber, */ | ||
| /* pxSegment->lDataLength, */ | ||
| /* pxWindow->ulNextTxSequenceNumber - pxWindow->tx.ulFirstSequenceNumber, */ | ||
| /* pxSegment->lStreamPos ) ); */ | ||
| /* FreeRTOS_flush_logging(); */ | ||
| /* } */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsed comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disabled the comment with double slashes, uncrustify replaced them by proper C comments /* */.
This is a very old logging statement, which increases the complexity of the function from 6 to 14.
As I haven't enabled any TCP_WIN logging for many years, I will take it away.
FreeRTOS_TCP_WIN.c
Outdated
| /* This out-of-sequence packet has been received for a | ||
| * second time. It is already stored but do send a SACK | ||
| * again. */ | ||
| /* A negative value will be returned to indicate than error. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /* A negative value will be returned to indicate than error. */ | |
| /* A negative value will be returned to indicate an error. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done so, thanks.
Description
The module FreeRTOS+TCP_WIN.c had 4 functions with a high score on complexity. I cut down their size by moving some code the helper functions:
lTCPWindowRxCheck() score 66
lTCPWindowTxAdd() score 35
ulTCPWindowTxGet() score 43
prvTCPWindowTxCheckAck() score 25
Test Steps
I tested by transferring files in both directions while dropping random packets in both directions.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.