~ubuntu-branches/ubuntu/vivid/curl/vivid

« back to all changes in this revision

Viewing changes to lib/tftp.c

  • Committer: Package Import Robot
  • Author(s): Alessandro Ghedini
  • Date: 2012-11-26 17:51:27 UTC
  • mto: (1.3.1) (3.6.1 experimental)
  • mto: This revision was merged to the branch mainline in revision 66.
  • Revision ID: package-import@ubuntu.com-20121126175127-12yqb822maaw0m2m
Tags: upstream-7.28.1
ImportĀ upstreamĀ versionĀ 7.28.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
591
591
  case TFTP_EVENT_DATA:
592
592
    /* Is this the block we expect? */
593
593
    rblock = getrpacketblock(&state->rpacket);
594
 
    if(NEXT_BLOCKNUM(state->block) != rblock) {
595
 
      /* No, log it */
 
594
    if(NEXT_BLOCKNUM(state->block) == rblock) {
 
595
      /* This is the expected block.  Reset counters and ACK it. */
 
596
      state->retries = 0;
 
597
    }
 
598
    else if(state->block == rblock) {
 
599
      /* This is the last recently received block again. Log it and ACK it
 
600
         again. */
 
601
      infof(data, "Received last DATA packet block %d again.\n", rblock);
 
602
    }
 
603
    else {
 
604
      /* totally unexpected, just log it */
596
605
      infof(data,
597
606
            "Received unexpected DATA packet block %d, expecting block %d\n",
598
607
            rblock, NEXT_BLOCKNUM(state->block));
599
608
      break;
600
609
    }
601
 
    /* This is the expected block.  Reset counters and ACK it. */
 
610
 
 
611
    /* ACK this block. */
602
612
    state->block = (unsigned short)rblock;
603
 
    state->retries = 0;
604
613
    setpacketevent(&state->spacket, TFTP_EVENT_ACK);
605
614
    setpacketblock(&state->spacket, state->block);
606
615
    sbytes = sendto(state->sockfd, (void *)state->spacket.data,