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
|
@ -369,8 +369,12 @@ accept_function(void *arg, struct tcp_pcb *newpcb, err_t err)
|
|||
#endif /* API_MSG_DEBUG */
|
||||
conn = (struct netconn *)arg;
|
||||
|
||||
LWIP_ERROR("accept_function: invalid conn->acceptmbox",
|
||||
conn->acceptmbox != SYS_MBOX_NULL, return ERR_VAL;);
|
||||
/* check whether acceptmbox is valid */
|
||||
if (conn->acceptmbox == SYS_MBOX_NULL)
|
||||
{
|
||||
LWIP_DEBUGF(API_MSG_DEBUG, ("accept_function: acceptmbox already deleted\n"));
|
||||
return ERR_VAL;
|
||||
}
|
||||
|
||||
/* We have to set the callback here even though
|
||||
* the new socket is unknown. conn->socket is marked as -1. */
|
||||
|
@ -508,6 +512,7 @@ netconn_alloc(enum netconn_type t, netconn_callback callback)
|
|||
(DEFAULT_RAW_RECVMBOX_SIZE == DEFAULT_TCP_RECVMBOX_SIZE)
|
||||
size = DEFAULT_RAW_RECVMBOX_SIZE;
|
||||
#else
|
||||
size = 0; /* skip warning */
|
||||
switch(NETCONNTYPE_GROUP(t)) {
|
||||
#if LWIP_RAW
|
||||
case NETCONN_RAW:
|
||||
|
|
|
@ -89,9 +89,13 @@ typedef rt_uint32_t mem_ptr_t;
|
|||
#endif
|
||||
|
||||
void sys_arch_assert(const char* file, int line);
|
||||
#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"
|
||||
|
||||
|
|
|
@ -118,6 +118,8 @@
|
|||
/* the number of simultaneously queued TCP */
|
||||
#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
|
||||
|
|
|
@ -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