From 01af510dfd7729eda55f7a7b14bcefa3ff3e6489 Mon Sep 17 00:00:00 2001 From: jonnosan Date: Thu, 26 Mar 2009 03:40:16 +0000 Subject: [PATCH] bugfix: was not sending a final (empty) packet if the file to send was an exact multiple of 512 bytes - without this packet, the client doesn't know the file has finished downloading git-svn-id: http://svn.code.sf.net/p/netboot65/code@53 93682198-c243-4bdb-bd91-e943c89aac3b --- server/lib/tftp_server.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/lib/tftp_server.rb b/server/lib/tftp_server.rb index 95b7da0..62319c8 100644 --- a/server/lib/tftp_server.rb +++ b/server/lib/tftp_server.rb @@ -48,7 +48,7 @@ class Netboot65TFTPServer client_sock=UDPSocket.open client_sock.connect(client_ip,client_port) - blocks_to_send=(data_to_send.length.to_f/512.0).ceil + blocks_to_send=1+(data_to_send.length.to_f/512.0).floor log_msg("sending #{filename} to #{client_ip}:#{client_port} (#{blocks_to_send} blocks)") blocks_to_send.times do |block_number| block_data=data_to_send[block_number*512,512]