Avoid changing file_extra_cnt during deletion. The I/O code can receive incremental file-list chunks during deletion, and their OPT_EXTRA fields would get corrupted when file_extra_cnt is incremented. Instead of temporarily enabling uid_ndx to find out whether the user owns a file, have make_file() set a flag for that purpose. Applied with a few minor tweaks by Wayne. Fixes bug 7936.
More --timeout improvements, especially for the receiving side: - The receiver now sends keep-alive messages to the generator when it is actively doing work and hasn't sent anything recently. This ensures that the generator won't timeout if the receiver is working hard. - The perform_io() code has improved keep-alive participation. - Allow the sender to send some keep-alive messages, which ensures that if it is in a lull, it can probe the socket.
Improve --timeout method to take into account all I/O that is going on. The receiving side also switches timeout handling from the receiver to the generator, which obviates the need for the sender to send any keep-alive messages at all (for protocol 31 and beyond). Given this setup, all keep-alive messages are now sent as empty MSG_DATA messages, with MSG_NOOP messages only being understood and (when necessary) acted upon to forward a keep-alive event to an older receiver. This is both safer and more compatible with older versions.
Added notifications about error-exit values: - The receiver notifies the generator if it is exiting with an error, and then, if it is a server, waits around for the generator to die. This ensures that the client side has time to read the error. - The generator or sender will notifiy the other side of the transfer of an error-exit value if protocol 31 is in effect. This will get rid of some "connection unexpectedly closed" errors that are really expected events due to a fatal exit on the other side.