Deleted Added
full compact
tftp-transfer.c (302408) tftp-transfer.c (332609)
1/*
2 * Copyright (C) 2008 Edwin Groothuis. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
1/*
2 * Copyright (C) 2008 Edwin Groothuis. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 * SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: stable/11/libexec/tftpd/tftp-transfer.c 224536 2011-07-31 03:12:20Z rodrigc $");
27__FBSDID("$FreeBSD: stable/11/libexec/tftpd/tftp-transfer.c 332609 2018-04-16 16:33:35Z asomers $");
28
29#include <sys/types.h>
30#include <sys/param.h>
31#include <sys/ioctl.h>
32#include <sys/stat.h>
33#include <sys/socket.h>
34
35#include <netinet/in.h>

--- 261 unchanged lines hidden (view full) ---

297 continue;
298 }
299
300 break;
301 }
302 gettimeofday(&(ts->tstop), NULL);
303 } while (n_data == segsize);
304
28
29#include <sys/types.h>
30#include <sys/param.h>
31#include <sys/ioctl.h>
32#include <sys/stat.h>
33#include <sys/socket.h>
34
35#include <netinet/in.h>

--- 261 unchanged lines hidden (view full) ---

297 continue;
298 }
299
300 break;
301 }
302 gettimeofday(&(ts->tstop), NULL);
303 } while (n_data == segsize);
304
305 write_close();
306
305 /* Don't do late packet management for the client implementation */
306 if (acting_as_client)
307 return;
308
309 for (i = 0; ; i++) {
310 n_data = receive_packet(peer, (char *)rp, pktsize,
311 NULL, timeoutpacket);
312 if (n_data <= 0)
313 break;
314 if (n_data > 0 &&
315 rp->th_opcode == DATA && /* and got a data block */
316 *block == rp->th_block) /* then my last ack was lost */
317 send_ack(peer, *block); /* resend final ack */
318 }
319
320abort:
321 return;
322}
307 /* Don't do late packet management for the client implementation */
308 if (acting_as_client)
309 return;
310
311 for (i = 0; ; i++) {
312 n_data = receive_packet(peer, (char *)rp, pktsize,
313 NULL, timeoutpacket);
314 if (n_data <= 0)
315 break;
316 if (n_data > 0 &&
317 rp->th_opcode == DATA && /* and got a data block */
318 *block == rp->th_block) /* then my last ack was lost */
319 send_ack(peer, *block); /* resend final ack */
320 }
321
322abort:
323 return;
324}