Better handle the case with a network that drops packets by retrying
with a back off. This was discovered when Luigi sent me code to handle this for Etherboot. The Etherboot patch worked okay but FreeBSD's tftpd had trouble handling it and would fail to transfer the file since it would abort on send and not retry. Submitted by: luigi MFC after: 1 week
This commit is contained in:
parent
f7565e52d7
commit
0b5427f932
@ -576,9 +576,19 @@ xmitfile(struct formats *pf)
|
||||
(void)setjmp(timeoutbuf);
|
||||
|
||||
send_data:
|
||||
if (send(peer, dp, size + 4, 0) != size + 4) {
|
||||
syslog(LOG_ERR, "write: %m");
|
||||
goto abort;
|
||||
{
|
||||
int i, t = 1;
|
||||
for (i = 0; ; i++){
|
||||
if (send(peer, dp, size + 4, 0) != size + 4) {
|
||||
sleep(t);
|
||||
t = (t < 32) ? t<< 1 : t;
|
||||
if (i >= 12) {
|
||||
syslog(LOG_ERR, "write: %m");
|
||||
goto abort;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
read_ahead(file, pf->f_convert);
|
||||
for ( ; ; ) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user