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
This commit is contained in:
jonnosan 2009-03-26 03:40:16 +00:00
parent a75eb83f10
commit 01af510dfd

View File

@ -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]