lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] Re: [lwip] TCP pcb's in ESTABLISHED hang around forever af


From: Adam Dunkels
Subject: [lwip-users] Re: [lwip] TCP pcb's in ESTABLISHED hang around forever after close
Date: Wed, 08 Jan 2003 23:06:08 -0000

Hi!

On Sat, 2002-07-13 at 21:29, Paul Sheer wrote:
> The current method of closing a socket is to call tcp_close(),
> unless pcb->unacked != NULL || pcb->unsent != NULL, in which
> case a tcp_sent() callback is given. pcb->sent() will close the
> socket once all data has been written and acknowledged.
> 
> (-- do i have this right?)

Yepp.

> I have found that this is insufficient to remove the pcb
> if my PPP link drops: we are sitting around waiting for
> an ACK that will never come, so pcb->sent() never gets
> called.

Hmmm, that should be taken care off once too many retransmissions have
been made. You could try modifying the TCP_MAXRTX option in lwipopts.h.

> currently I have -
> 
> (gdb) p  *tcp_active_pcbs
> $13 = {magic = 2935488814, backtrace = {0 <repeats 32 times>}, next = 
> 0x816b448, state = ESTABLISHED, prio = 64 '@', 
>   padp = "\000\000", callback_arg = 0x0, local_ip = {addr = 579268507}, 
> remote_ip = {addr = 1505233984}, local_port = 4240, 
>   remote_port = 80, rcv_nxt = 327251779, rcv_wnd = 2816, tmr = 4558, rtime = 
> 99 'c', pad0 = 0 '\000', mss = 352, 
>   flags = 0 '\000', pad1 = 0 '\000', rttest = 4556, rtseq = 1157514982, sa = 
> 0, sv = 6, nrtx = 0 '\000', 
>   dupacks = 0 '\000', rto = 6, lastack = 1157514983, cwnd = 352, ssthresh = 
> 3520, snd_nxt = 1157514983, 
>   snd_max = 1181664429, snd_wnd = 8448, snd_wl1 = 327251778, snd_wl2 = 
> 1181664429, snd_lbb = 1157514983, 
>   snd_queuelen = 0 '\000', pad2 = 0 '\000', snd_buf = 2815, acked = 0, pad3 = 
> 0, sent = 0x80cc668 <_socket_sent>, recv = 0, 
>   connected = 0x80cd8f4 <_socket_connect>, accept = 0, poll = 0, errf = 0, 
> polltmr = 0 '\000', pollinterval = 0 '\000', 
>   pad4 = 0, unsent = 0x0, unacked = 0x0, ooseq = 0x0}
> (gdb) c
> 
> for my hanging pcb (if that helps at all).
>
> but how come was pcb->sent() never called???
> does anyone have an idea what my code is doing here?

Both ->unsent and ->unacked are NULL, so it seems as if all data has
been sent and acknowledged...
 
> currently I am thinking of adding a new structure
> member pcb->die_timeout. This gives the calling app
> tighter control. You can set die_timeout at any time
> you think the tcp connection should *really* not hang
> around for longer than a given number of seconds.

It is also possible to use the polling functionality. TCP will poll the
application with a specific interval when the connection is idle.

/adam
-- 
Adam Dunkels <address@hidden>
http://www.dunkels.com/adam/

[This message was sent through the lwip discussion list.]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]