/[inetutils]/inetutils/tftpd/tftpd.c
ViewVC logotype

Diff of /inetutils/tftpd/tftpd.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by ams, Thu Sep 22 09:06:16 2005 UTC revision 1.17 by gray, Tue Oct 11 11:16:16 2005 UTC
# Line 508  send_file (struct formats *pf) Line 508  send_file (struct formats *pf)
508        dp->th_opcode = htons ((u_short) DATA);        dp->th_opcode = htons ((u_short) DATA);
509        dp->th_block = htons ((u_short) block);        dp->th_block = htons ((u_short) block);
510        timeout = 0;        timeout = 0;
511        (void) setjmp (timeoutbuf);        setjmp (timeoutbuf);
512    
513      send_data:      send_data:
514        if (send (peer, (const char *) dp, size + 4, 0) != size + 4)        if (send (peer, (const char *) dp, size + 4, 0) != size + 4)
# Line 538  send_file (struct formats *pf) Line 538  send_file (struct formats *pf)
538                if ((u_short) ap->th_block == (u_short) block)                if ((u_short) ap->th_block == (u_short) block)
539                  break;                  break;
540                /* Re-synchronize with the other side */                /* Re-synchronize with the other side */
541                (void) synchnet (peer);                synchnet (peer);
542                if ((u_short) ap->th_block == (u_short) (block - 1))                if ((u_short) ap->th_block == (u_short) (block - 1))
543                  goto send_data;                  goto send_data;
544              }              }
# Line 548  send_file (struct formats *pf) Line 548  send_file (struct formats *pf)
548      }      }
549    while (size == SEGSIZE);    while (size == SEGSIZE);
550  abort:  abort:
551    (void) fclose (file);    fclose (file);
552  }  }
553    
554  void  void
# Line 579  recvfile (struct formats *pf) Line 579  recvfile (struct formats *pf)
579        ap->th_opcode = htons ((u_short) ACK);        ap->th_opcode = htons ((u_short) ACK);
580        ap->th_block = htons ((u_short) block);        ap->th_block = htons ((u_short) block);
581        block++;        block++;
582        (void) setjmp (timeoutbuf);        setjmp (timeoutbuf);
583      send_ack:      send_ack:
584        if (send (peer, ackbuf, 4, 0) != 4)        if (send (peer, ackbuf, 4, 0) != 4)
585          {          {
# Line 608  recvfile (struct formats *pf) Line 608  recvfile (struct formats *pf)
608                    break;        /* normal */                    break;        /* normal */
609                  }                  }
610                /* Re-synchronize with the other side */                /* Re-synchronize with the other side */
611                (void) synchnet (peer);                synchnet (peer);
612                if (dp->th_block == (block - 1))                if (dp->th_block == (block - 1))
613                  goto send_ack;  /* rexmit */                  goto send_ack;  /* rexmit */
614              }              }
# Line 626  recvfile (struct formats *pf) Line 626  recvfile (struct formats *pf)
626      }      }
627    while (size == SEGSIZE);    while (size == SEGSIZE);
628    write_behind (file, pf->f_convert);    write_behind (file, pf->f_convert);
629    (void) fclose (file);         /* close data file */    fclose (file);                /* close data file */
630    
631    ap->th_opcode = htons ((u_short) ACK);        /* send the "final" ack */    ap->th_opcode = htons ((u_short) ACK);        /* send the "final" ack */
632    ap->th_block = htons ((u_short) (block));    ap->th_block = htons ((u_short) (block));
633    (void) send (peer, ackbuf, 4, 0);    send (peer, ackbuf, 4, 0);
634    
635    signal (SIGALRM, justquit);   /* just quit on timeout */    signal (SIGALRM, justquit);   /* just quit on timeout */
636    alarm (rexmtval);    alarm (rexmtval);
# Line 640  recvfile (struct formats *pf) Line 640  recvfile (struct formats *pf)
640        dp->th_opcode == DATA &&  /* and got a data block */        dp->th_opcode == DATA &&  /* and got a data block */
641        block == dp->th_block)        block == dp->th_block)
642      {                           /* then my last ack was lost */      {                           /* then my last ack was lost */
643        (void) send (peer, ackbuf, 4, 0); /* resend final ack */        send (peer, ackbuf, 4, 0);        /* resend final ack */
644      }      }
645  abort:  abort:
646    return;    return;

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26