source:
freewrt/package/atftp/patches/120-retry_setting.patch@
428f140
| Last change on this file since 428f140 was 475ad56, checked in by , 20 years ago | |
|---|---|
|
|
| File size: 4.6 KB | |
-
tftp.c
diff -urN atftp.old/tftp.c atftp.dev/tftp.c
old new 967 967 { "tftp-timeout", 1, NULL, 'T'}, 968 968 { "mode", 1, NULL, 'M'}, 969 969 { "option", 1, NULL, 'O'}, 970 { "retry", 1, NULL, 'R'}, 970 971 #if 1 971 972 { "timeout", 1, NULL, 't'}, 972 973 { "blksize", 1, NULL, 'b'}, … … 986 987 }; 987 988 988 989 /* Support old argument until 0.8 */ 989 while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:sm ",990 while ((c = getopt_long(argc, argv, /*"gpl:r:Vh"*/ "gpl:r:Vht:b:smR:", 990 991 options, &option_index)) != EOF) 991 992 { 992 993 switch (c) 993 994 { 995 case 'R': 996 snprintf(string, sizeof(string), "option retry %s", optarg); 997 make_arg(string, &ac, &av); 998 process_cmd(ac, av); 999 break; 994 1000 case 'g': 995 1001 interactive = 0; 996 1002 if ((action == PUT) || (action == MGET)) -
tftp_def.c
diff -urN atftp.old/tftp_def.c atftp.dev/tftp_def.c
old new 37 37 { "timeout", "5", 0, 1 }, /* 2348, 2349, 2090. */ 38 38 { "blksize", "512", 0, 1 }, /* This is the default option */ 39 39 { "multicast", "", 0, 1 }, /* structure */ 40 { "retry", "5", 0, 1 }, 40 41 { "", "", 0, 0} 41 42 }; 42 43 -
tftp_def.h
diff -urN atftp.old/tftp_def.h atftp.dev/tftp_def.h
old new 40 40 #define OPT_TIMEOUT 3 41 41 #define OPT_BLKSIZE 4 42 42 #define OPT_MULTICAST 5 43 #define OPT_NUMBER 7 43 #define OPT_RETRY 6 44 #define OPT_NUMBER 8 44 45 45 46 #define OPT_SIZE 12 46 47 #define VAL_SIZE MAXLEN -
tftp_file.c
diff -urN atftp.old/tftp_file.c atftp.dev/tftp_file.c
old new 123 123 struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer; 124 124 FILE *fp = NULL; /* the local file pointer */ 125 125 int number_of_timeout = 0; 126 int num_retry = atoi(data->tftp_options[OPT_RETRY].value); 126 127 int convert = 0; /* if true, do netascii convertion */ 127 128 128 129 int oacks = 0; /* count OACK for improved error checking */ … … 141 142 142 143 int prev_block_number = 0; /* needed to support netascii convertion */ 143 144 int temp = 0; 144 145 145 146 data->file_size = 0; 146 147 tftp_cancel = 0; 147 148 from.sin_addr.s_addr = 0; … … 288 289 case GET_TIMEOUT: 289 290 number_of_timeout++; 290 291 fprintf(stderr, "timeout: retrying...\n"); 291 if ( number_of_timeout > NB_OF_RETRY)292 if ((num_retry > 0) && (number_of_timeout > num_retry)) 292 293 state = S_ABORT; 293 294 else 294 295 state = timeout_state; … … 325 326 number_of_timeout++; 326 327 fprintf(stderr, "tftp: packet discard <%s:%d>.\n", 327 328 inet_ntoa(from.sin_addr), ntohs(from.sin_port)); 328 if ( number_of_timeout > NB_OF_RETRY)329 if ((num_retry > 0) && (number_of_timeout > num_retry)) 329 330 state = S_ABORT; 330 331 break; 331 332 case ERR: … … 614 615 struct tftphdr *tftphdr = (struct tftphdr *)data->data_buffer; 615 616 FILE *fp; /* the local file pointer */ 616 617 int number_of_timeout = 0; 618 int num_retry = atoi(data->tftp_options[OPT_RETRY].value); 617 619 struct stat file_stat; 618 620 int convert = 0; /* if true, do netascii convertion */ 619 621 char string[MAXLEN]; … … 751 753 case GET_TIMEOUT: 752 754 number_of_timeout++; 753 755 fprintf(stderr, "timeout: retrying...\n"); 754 if ( number_of_timeout > NB_OF_RETRY)756 if ((num_retry > 0) && (number_of_timeout > num_retry)) 755 757 state = S_ABORT; 756 758 else 757 759 state = timeout_state; … … 797 799 number_of_timeout++; 798 800 fprintf(stderr, "tftp: packet discard <%s:%d>.\n", 799 801 inet_ntoa(from.sin_addr), ntohs(from.sin_port)); 800 if ( number_of_timeout > NB_OF_RETRY)802 if ((num_retry > 0) && (number_of_timeout > num_retry)) 801 803 state = S_ABORT; 802 804 break; 803 805 case ERR:
Note:
See TracBrowser
for help on using the repository browser.
