fixed lwip accept issue, if this connection has been deleted; added list_tcps function in finsh shell.
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1693 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
694a78f154
commit
2fe93c9224
File diff suppressed because it is too large
Load Diff
|
@ -89,9 +89,13 @@ typedef rt_uint32_t mem_ptr_t;
|
|||
#endif
|
||||
|
||||
void sys_arch_assert(const char* file, int line);
|
||||
#define LWIP_PLATFORM_DIAG(x) do {rt_kprintf x;} while(0)
|
||||
#ifdef LWIP_DEBUG
|
||||
#define LWIP_PLATFORM_DIAG(x) do {rt_kprintf x;} while(0)
|
||||
#define LWIP_PLATFORM_ASSERT(x) { rt_kprintf(x); sys_arch_assert(__FILE__, __LINE__); }
|
||||
|
||||
#else
|
||||
#define LWIP_PLATFORM_DIAG(x)
|
||||
#define LWIP_PLATFORM_ASSERT(x)
|
||||
#endif
|
||||
|
||||
#include "string.h"
|
||||
|
||||
|
|
|
@ -116,9 +116,11 @@
|
|||
#endif
|
||||
|
||||
/* the number of simultaneously queued TCP */
|
||||
#ifdef RT_LWIP_TCP_SEG_NUM
|
||||
#define MEMP_NUM_TCP_SEG RT_LWIP_TCP_SEG_NUM
|
||||
#endif
|
||||
#ifdef RT_LWIP_TCP_SEG_NUM
|
||||
#define MEMP_NUM_TCP_SEG RT_LWIP_TCP_SEG_NUM
|
||||
#else
|
||||
#define MEMP_NUM_TCP_SEG TCP_SND_QUEUELEN
|
||||
#endif
|
||||
|
||||
/* MEMP_NUM_SYS_TIMEOUT: the number of simulateously active
|
||||
timeouts. */
|
||||
|
|
|
@ -367,4 +367,45 @@ void list_if()
|
|||
#endif
|
||||
}
|
||||
FINSH_FUNCTION_EXPORT(list_if, list network interface information);
|
||||
|
||||
#include <lwip/tcp.h>
|
||||
void list_tcps()
|
||||
{
|
||||
struct tcp_pcb *pcb;
|
||||
extern struct tcp_pcb *tcp_active_pcbs;
|
||||
extern union tcp_listen_pcbs_t tcp_listen_pcbs;
|
||||
extern struct tcp_pcb *tcp_tw_pcbs;
|
||||
extern const char *tcp_state_str[];
|
||||
|
||||
rt_enter_critical();
|
||||
rt_kprintf("Active PCB states:\n");
|
||||
for(pcb = tcp_active_pcbs; pcb != NULL; pcb = pcb->next)
|
||||
{
|
||||
rt_kprintf("%s:%d <==> %s:%d snd_nxt %d rcv_nxt %d ",
|
||||
inet_ntoa(*((struct in_addr*)&(pcb->local_ip))), pcb->local_port,
|
||||
inet_ntoa(*((struct in_addr*)&(pcb->remote_ip))), pcb->remote_port,
|
||||
pcb->snd_nxt, pcb->rcv_nxt);
|
||||
rt_kprintf("state: %s\n", tcp_state_str[pcb->state]);
|
||||
}
|
||||
|
||||
rt_kprintf("Listen PCB states:\n");
|
||||
for(pcb = (struct tcp_pcb *)tcp_listen_pcbs.pcbs; pcb != NULL; pcb = pcb->next)
|
||||
{
|
||||
rt_kprintf("local port %d ", pcb->local_port);
|
||||
rt_kprintf("state: %s\n", tcp_state_str[pcb->state]);
|
||||
}
|
||||
|
||||
rt_kprintf("TIME-WAIT PCB states:\n");
|
||||
for(pcb = tcp_tw_pcbs; pcb != NULL; pcb = pcb->next)
|
||||
{
|
||||
rt_kprintf("%s:%d <==> %s:%d snd_nxt %d rcv_nxt %d ",
|
||||
inet_ntoa(*((struct in_addr*)&(pcb->local_ip))), pcb->local_port,
|
||||
inet_ntoa(*((struct in_addr*)&(pcb->remote_ip))), pcb->remote_port,
|
||||
pcb->snd_nxt, pcb->rcv_nxt);
|
||||
rt_kprintf("state: %s\n", tcp_state_str[pcb->state]);
|
||||
}
|
||||
rt_exit_critical();
|
||||
}
|
||||
FINSH_FUNCTION_EXPORT(list_tcps, list all of tcp pcb);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue