It's almost always an error to get an EOF when we're trying to read from the * network, because the protocol is (for the most part) self-terminating. * * There is one case for the receiver when it is at the end of the transfer * (hanging around reading any keep-alive packets that might come its way): if * the sender dies before the generator's kill-signal comes through, we can end * up here
| 215 | * listing was not terminated, so we must ignore an EOF error in that case and |
| 216 | * exit. In this situation, kluge_around_eof will be > 0. */ |
| 217 | static NORETURN void whine_about_eof(BOOL allow_kluge) |
| 218 | { |
| 219 | if (kluge_around_eof && allow_kluge) { |
| 220 | int i; |
| 221 | if (kluge_around_eof > 0) |
| 222 | exit_cleanup(0); |
| 223 | /* If we're still here after 10 seconds, exit with an error. */ |
| 224 | for (i = 10*1000/20; i--; ) |
| 225 | msleep(20); |
| 226 | } |
| 227 | |
| 228 | rprintf(FERROR, RSYNC_NAME ": connection unexpectedly closed " |
| 229 | "(%s bytes received so far) [%s]\n", |
| 230 | big_num(stats.total_read), who_am_i()); |
| 231 | |
| 232 | exit_cleanup(RERR_STREAMIO); |
| 233 | } |
| 234 | |
| 235 | /* Do a safe read, handling any needed looping and error handling. |
| 236 | * Returns the count of the bytes read, which will only be different |