home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff225.lzh / AmigaTCP / src / tcptimer.c < prev    next >
C/C++ Source or Header  |  1989-06-24  |  869b  |  42 lines

  1. /* TCP timeout routines */
  2. #include <stdio.h>
  3. #include "machdep.h"
  4. #include "timer.h"
  5. #include "mbuf.h"
  6. #include "netuser.h"
  7. #include "internet.h"
  8. #include "ip.h"
  9. #include "tcp.h"
  10.  
  11. /* Timer timeout */
  12. void
  13. tcp_timeout(arg)
  14. int *arg;
  15. {
  16.     register struct tcb *tcb;
  17.  
  18.     tcb = (struct tcb *)arg;
  19.     switch(tcb->state){
  20.     case TIME_WAIT:        /* 2MSL timer has expired */
  21.         close_self(tcb,NORMAL);
  22.         break;
  23.     default:        /* Retransmission timer has expired */
  24.         if(tcb->retry < RETRY){
  25.             tcb->retry++;
  26.             tcb->snd.ptr = tcb->snd.una;
  27.             /* Back off on retransmission timer;
  28.              * on closed window probes, limit it to
  29.              * BACKOFF x the current round trip estimate
  30.              */
  31.             tcb->timer.start <<= 1;
  32.             if(tcb->snd.wnd == 0)
  33.                 tcb->timer.start =
  34.                  min(tcb->timer.start,BACKOFF*tcb->srtt/MSPTICK);
  35.             tcp_output(tcb);
  36.         } else {
  37.             /* Give up */
  38.             close_self(tcb,TIMEOUT);
  39.         }
  40.     }
  41. }
  42.