Re: lftp 4.5.4
"Alexander V. Lukyanov" <[email protected]>
| Newsgroups | gmane.network.lftp.user |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Aug 11, 2014 at 09:22:16AM +0200, Mattias Bergvall wrote: > I wonder how to prevent retries and to make LFTP fail-exit on connection > problems (when the server is down, for instance). Please try this patch. -- Alexander. _______________________________________________ lftp mailing list [email protected] http://univ.uniyar.ac.ru/mailman/listinfo/lftp
diff
(text/plain, 1.3 KB)
diff --git a/src/FileAccess.cc b/src/FileAccess.cc
index 7582e4f..1b13074 100644
--- a/src/FileAccess.cc
+++ b/src/FileAccess.cc
@@ -59,6 +59,7 @@ void FileAccess::Init()
pos=0;
mode=CLOSED;
retries=0;
+ max_retries=0;
opt_date=0;
opt_size=0;
fileset_for_info=0;
@@ -192,7 +193,6 @@ void FileAccess::Close()
opt_size=0;
fileset_for_info=0;
retries=0;
- max_retries=0;
entity_size=NO_SIZE;
entity_date=NO_DATE;
ascii=false;
diff --git a/src/NetAccess.cc b/src/NetAccess.cc
index 2316579..18a9fdd 100644
--- a/src/NetAccess.cc
+++ b/src/NetAccess.cc
@@ -317,17 +317,20 @@ bool NetAccess::NextTry()
reconnect_interval_current=reconnect_interval_max;
}
retries++;
+ LogNote(10,"attempt number %d (max_retries=%d)",retries,max_retries);
return CheckRetries();
}
bool NetAccess::CheckRetries()
{
if(max_retries>0 && retries>max_retries)
{
- Fatal(_("max-retries exceeded"));
+ if(!IsConnected() && last_disconnect_cause)
+ Fatal(xstring::cat(_("max-retries exceeded")," (",last_disconnect_cause.get(),")",NULL));
+ else
+ Fatal(_("max-retries exceeded"));
return false;
}
reconnect_timer.Set(reconnect_interval_current);
- LogNote(10,"attempt number %d",retries);
return true;
}
void NetAccess::TrySuccess()