lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] [lwip] TCP pcb's in ESTABLISHED hang around forever after


From: Paul Sheer
Subject: [lwip-users] [lwip] TCP pcb's in ESTABLISHED hang around forever after close
Date: Wed, 08 Jan 2003 22:46:49 -0000

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?)

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.

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?

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.

         TCP_FIN_WAIT_TIMEOUT / TCP_SLOW_INTERVAL) {
         ++pcb_remove;
       }
     }
+
+    if(pcb->die_timeout) {
+      if((u32_t)(tcp_ticks - pcb->tmr) >
+        (u32_t)pcb->die_timeout * 1000 / TCP_SLOW_INTERVAL) {
+        ++pcb_remove;
+      }
+    }
 
     /* If this PCB has queued out of sequence data, but has been
        inactive for too long, will drop the data (it will eventually
       be retransmitted). */
 #if TCP_QUEUE_OOSEQ    
     if(pcb->ooseq != NULL &&
        (u32_t)tcp_ticks - pcb->tmr >=

-paul

>From 1 July 2002 my new Tel is . . . . . . . . .  +27 21 686 9634
Paul Sheer Consulting IT Services . . . Tel . . . +27 21 761 7224
Email . . . address@hidden . . . . . . Pager . . . 088 0057245
Linux development, cryptography, recruitment,  support,  training
http://www.icon.co.za/~psheer . . . . http://rute.sourceforge.net
L I N U X . . . . . . . . . . . .  The Choice of a GNU Generation
[This message was sent through the lwip discussion list.]




reply via email to

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