Ensure the private port number wrap check is inside the critical section in prvGetPrivatePortNumber() (UDP).

Add missing default values for some of the trace macros.
This commit is contained in:
Richard Barry 2013-10-23 10:28:17 +00:00
parent 63bd3ebbef
commit 818abc468d
2 changed files with 29 additions and 10 deletions

View file

@ -932,17 +932,19 @@ uint16_t usReturn;
/* Assign the next port in the range. */
taskENTER_CRITICAL();
usNextPortToUse++;
taskEXIT_CRITICAL();
/* Has it overflowed? */
if( usNextPortToUse == 0U )
{
/* Don't go right back to the start of the dynamic/private port
range numbers as any persistent sockets are likely to have been
create first so the early port numbers may still be in use. */
usNextPortToUse = socketAUTO_PORT_ALLOCATION_RESET_NUMBER;
usNextPortToUse++;
/* Has it overflowed? */
if( usNextPortToUse == 0U )
{
/* Don't go right back to the start of the dynamic/private port
range numbers as any persistent sockets are likely to have been
create first so the early port numbers may still be in use. */
usNextPortToUse = socketAUTO_PORT_ALLOCATION_RESET_NUMBER;
}
}
taskEXIT_CRITICAL();
usReturn = FreeRTOS_htons( usNextPortToUse );