@ -790,9 +790,12 @@ void tcp_slowtmr(struct lwip_tcp_ctx *ctx)
pcb = ctx - > tw_pcbs ;
pcb = ctx - > tw_pcbs ;
while ( pcb ! = NULL ) {
while ( pcb ! = NULL ) {
if ( ! pcb - > ctx ) {
if ( ! pcb - > ctx ) {
DEBUG_ERROR ( DEBUG_CATEGORY_ALL , " TW_PCBS DANGLING pcb=%p ctx=NULL in tcp_slowtmr, clearing tw_pcbs " , ( void * ) pcb ) ;
DEBUG_ERROR ( DEBUG_CATEGORY_ALL , " TW_PCBS DANGLING pcb=%p ctx=NULL in tcp_slowtmr — HALTING " , ( void * ) pcb ) ;
ctx - > tw_pcbs = NULL ;
volatile int _halt = 1 ; while ( _halt ) { }
break ;
}
if ( memory_pool_is_freed ( pcb - > ctx - > pcb_pool , pcb ) ) {
DEBUG_ERROR ( DEBUG_CATEGORY_ALL , " TW_PCBS DANGLING pcb=%p IS FREED in tcp_slowtmr — HALTING " , ( void * ) pcb ) ;
volatile int _halt = 1 ; while ( _halt ) { }
}
}
pcb_remove = 0 ;
pcb_remove = 0 ;
@ -1033,9 +1036,12 @@ static void tcp_kill_timewait(struct lwip_tcp_ctx *ctx)
inactive = NULL ;
inactive = NULL ;
for ( pcb = ctx - > tw_pcbs ; pcb ! = NULL ; pcb = pcb - > next ) {
for ( pcb = ctx - > tw_pcbs ; pcb ! = NULL ; pcb = pcb - > next ) {
if ( ! pcb - > ctx ) {
if ( ! pcb - > ctx ) {
DEBUG_ERROR ( DEBUG_CATEGORY_ALL , " TW_PCBS DANGLING pcb=%p ctx=NULL in tcp_kill_timewait, clearing tw_pcbs " , ( void * ) pcb ) ;
DEBUG_ERROR ( DEBUG_CATEGORY_ALL , " TW_PCBS DANGLING pcb=%p ctx=NULL in tcp_kill_timewait — HALTING " , ( void * ) pcb ) ;
ctx - > tw_pcbs = NULL ;
volatile int _halt = 1 ; while ( _halt ) { }
return ;
}
if ( memory_pool_is_freed ( pcb - > ctx - > pcb_pool , pcb ) ) {
DEBUG_ERROR ( DEBUG_CATEGORY_ALL , " TW_PCBS DANGLING pcb=%p IS FREED in tcp_kill_timewait — HALTING " , ( void * ) pcb ) ;
volatile int _halt = 1 ; while ( _halt ) { }
}
}
if ( ( uint32_t ) ( ctx - > ticks - pcb - > tmr ) > = inactivity ) {
if ( ( uint32_t ) ( ctx - > ticks - pcb - > tmr ) > = inactivity ) {
inactivity = ctx - > ticks - pcb - > tmr ;
inactivity = ctx - > ticks - pcb - > tmr ;
@ -1103,18 +1109,6 @@ struct tcp_pcb *tcp_alloc(struct lwip_tcp_ctx *ctx, uint8_t prio)
if ( pcb ! = NULL ) {
if ( pcb ! = NULL ) {
memset ( pcb , 0 , sizeof ( struct tcp_pcb ) ) ;
memset ( pcb , 0 , sizeof ( struct tcp_pcb ) ) ;
# ifdef DEBUG
{
struct tcp_pcb * _tmp ;
for ( _tmp = ctx - > tw_pcbs ; _tmp ; _tmp = _tmp - > next ) {
if ( _tmp = = pcb ) {
DEBUG_ERROR ( DEBUG_CATEGORY_ALL , " tcp_alloc: REUSED PCB %p STILL IN tw_pcbs! halting for debug " , ( void * ) pcb ) ;
volatile int _halt = 1 ;
while ( _halt ) { }
}
}
}
# endif
pcb - > prio = prio ;
pcb - > prio = prio ;
pcb - > ctx = ctx ;
pcb - > ctx = ctx ;
pcb - > snd_buf = TCP_SND_BUF ;
pcb - > snd_buf = TCP_SND_BUF ;