tftp: Send an ack to the last data packet.

The way the tftp callback was written, it would claim success after receiving
the last data packet but wouldn't ack it back to the tftp server. This change
makes sure the last ack is actually sent, and makes sure the tftp client code
realizes a response was received so it doesn't resend the ack unnecessarily.

Change-Id: Ieb1cf4c245e5365921efb5191252e42919262d9d
diff --git a/src/net/netboot/tftp.c b/src/net/netboot/tftp.c
index 3cdf5f7..64a0b1d 100644
--- a/src/net/netboot/tftp.c
+++ b/src/net/netboot/tftp.c
@@ -164,12 +164,6 @@
 	}
 	tftp_total_size += new_data_len;
 
-	// If this block was less than the maximum size, the transfer is done.
-	if (new_data_len < TftpMaxBlockSize) {
-		tftp_status = TftpSuccess;
-		return;
-	}
-
 	// Prepare an ack.
 	TftpAckPacket ack = {
 		htonw(TftpAck),
@@ -178,6 +172,14 @@
 	memcpy(uip_appdata, &ack, sizeof(ack));
 	uip_udp_send(sizeof(ack));
 
+	tftp_got_response = 1;
+
+	// If this block was less than the maximum size, the transfer is done.
+	if (new_data_len < TftpMaxBlockSize) {
+		tftp_status = TftpSuccess;
+		return;
+	}
+
 	// Move on to the next block.
 	tftp_blocknum++;
 
@@ -185,7 +187,6 @@
 		// Give some feedback that something is happening.
 		printf("#");
 	}
-	tftp_got_response = 1;
 }
 
 int tftp_read(void *dest, uip_ipaddr_t *server_ip, const char *bootfile,