Skip to content
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

Adds a warning if the stream-buffer or windows properties are changed… #1188

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions source/FreeRTOS_Sockets.c
Original file line number Diff line number Diff line change
Expand Up @@ -2356,17 +2356,25 @@ void * vSocketClose( FreeRTOS_Socket_t * pxSocket )
uint32_t ulNewValue;
BaseType_t xReturn;

if( ( FreeRTOS_issocketconnected( pxSocket ) == pdTRUE ) )
{
/* If this socket is the child of a listening socket, the remote client may or may not have already sent
* us data. If data was already sent, then pxSocket->u.xTCP.rxStream != NULL and this call will fail.
* Warn the user about this inconsistent behavior. */
FreeRTOS_printf( ( "Warning: Changing buffer/window properties on a connected socket may fail." ) );
}

if( pxSocket->ucProtocol != ( uint8_t ) FREERTOS_IPPROTO_TCP )
{
FreeRTOS_debug_printf( ( "Set SO_%sBUF: wrong socket type\n",
( lOptionName == FREERTOS_SO_SNDBUF ) ? "SND" : "RCV" ) );
FreeRTOS_printf( ( "Set SO_%sBUF: wrong socket type\n",
( lOptionName == FREERTOS_SO_SNDBUF ) ? "SND" : "RCV" ) );
xReturn = -pdFREERTOS_ERRNO_EINVAL;
}
else if( ( ( lOptionName == FREERTOS_SO_SNDBUF ) && ( pxSocket->u.xTCP.txStream != NULL ) ) ||
( ( lOptionName == FREERTOS_SO_RCVBUF ) && ( pxSocket->u.xTCP.rxStream != NULL ) ) )
{
FreeRTOS_debug_printf( ( "Set SO_%sBUF: buffer already created\n",
( lOptionName == FREERTOS_SO_SNDBUF ) ? "SND" : "RCV" ) );
FreeRTOS_printf( ( "Set SO_%sBUF: buffer already created\n",
( lOptionName == FREERTOS_SO_SNDBUF ) ? "SND" : "RCV" ) );
xReturn = -pdFREERTOS_ERRNO_EINVAL;
}
else
Expand Down
Loading