Hi,
this annoying behaviour is caused by resetting the socket
data structure before sending the final ack packet. Changing the
calling order should fix this. The new behaviour is
in case of no error:
1. sent final ack
2. reset socket data structure
3. close file etc.
in case of an error:
1. reset socket data structure
2. close file etc.
Stella:/tmp/netkit-tftp-0.17/tftp# diff -urN tftp.c.org tftp.c
--- tftp.c.org 2008-12-28 11:00:17.000000000 +0100
+++ tftp.c 2008-12-28 11:08:08.000000000 +0100
@@ -296,11 +296,14 @@
}
amount += size;
} while (size == SEGSIZE);
-abort:
- initsock();
+
ap->th_opcode = htons((u_short)ACK); /* has seen err msg */
ap->th_block = htons((u_short)block);
(void) sendto(f, ackbuf, 4, 0, (struct sockaddr *)&s_inn,
sizeof(s_inn));
+
+abort:
+ initsock();
+
write_behind(file, convert); /* flush last buffer */
fclose(file);
stopclock();
Regards
hmw
--
biff4emacsen - A biff-like tool for (X)Emacs
http://www.c0t0d0s0.de/biff4emacsen/biff4emacsen.html
Flood - Your friendly network packet generator
http://www.c0t0d0s0.de/flood/flood.html
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]