// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-item.cc,v 1.13 1998/11/22 03:20:30 jgg Exp $
+// $Id: acquire-item.cc,v 1.14 1998/11/29 01:24:14 jgg Exp $
/* ######################################################################
Acquire Item - Item to acquire
Status = StatIdle;
if (QueueCounter <= 1)
{
+ /* This indicates that the file is not available right now but might
+ be sometime later. If we do a retry cycle then this should be
+ retried */
+ if (StringToBool(LookupTag(Message,"Transient-Failure"),false) == true)
+ {
+ Status = StatIdle;
+ Owner->Dequeue(this);
+ return;
+ }
+
ErrorText = LookupTag(Message,"Message");
Status = StatError;
Owner->Dequeue(this);
struct stat Buf;
if (stat(Final.c_str(),&Buf) != 0)
- return string();
+ return "\nIndex-File: true";
- return "\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
+ return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
}
/*}}}*/
// AcqIndex::Done - Finished a fetch /*{{{*/
struct stat Buf;
if (stat(Final.c_str(),&Buf) != 0)
- return string();
+ return "\nIndex-File: true";
- return "\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
+ return "\nIndex-File: true\nLast-Modified: " + TimeRFC1123(Buf.st_mtime);
}
/*}}}*/
// AcqIndexRel::Done - Item downloaded OK /*{{{*/
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-method.cc,v 1.8 1998/11/14 01:39:41 jgg Exp $
+// $Id: acquire-method.cc,v 1.9 1998/11/29 01:24:15 jgg Exp $
/* ######################################################################
Acquire Method
if ((Flags & SingleInstance) == SingleInstance)
strcat(End,"Single-Instance: true\n");
- if ((Flags & PreScan) == PreScan)
- strcat(End,"Pre-Scan: true\n");
-
if ((Flags & Pipeline) == Pipeline)
strcat(End,"Pipeline: true\n");
// AcqMethod::Fail - A fetch has failed /*{{{*/
// ---------------------------------------------------------------------
/* */
-void pkgAcqMethod::Fail()
+void pkgAcqMethod::Fail(bool Transient)
{
string Err = "Undetermined Error";
if (_error->empty() == false)
_error->PopMessage(Err);
_error->Discard();
- Fail(Err);
+ Fail(Err,Transient);
}
/*}}}*/
// AcqMethod::Fail - A fetch has failed /*{{{*/
// ---------------------------------------------------------------------
/* */
-void pkgAcqMethod::Fail(string Err)
+void pkgAcqMethod::Fail(string Err,bool Transient)
{
char S[1024];
if (Queue != 0)
{
snprintf(S,sizeof(S),"400 URI Failure\nURI: %s\n"
- "Message: %s\n\n",Queue->Uri.c_str(),Err.c_str());
-
+ "Message: %s\n",Queue->Uri.c_str(),Err.c_str());
+
// Dequeue
FetchItem *Tmp = Queue;
Queue = Queue->Next;
}
else
snprintf(S,sizeof(S),"400 URI Failure\nURI: <UNKNOWN>\n"
- "Message: %s\n\n",Err.c_str());
+ "Message: %s\n",Err.c_str());
+ // Set the transient flag
+ if (Transient == true)
+ strcat(S,"Transient-Failure: true\n\n");
+ else
+ strcat(S,"\n");
+
if (write(STDOUT_FILENO,S,strlen(S)) != (signed)strlen(S))
exit(100);
}
Tmp->DestFile = LookupTag(Message,"FileName");
if (StrToTime(LookupTag(Message,"Last-Modified"),Tmp->LastModified) == false)
Tmp->LastModified = 0;
-
+ Tmp->IndexFile = StringToBool(LookupTag(Message,"Index-File"),false);
Tmp->Next = 0;
// Append it to the list
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-method.h,v 1.3 1998/11/14 01:39:43 jgg Exp $
+// $Id: acquire-method.h,v 1.4 1998/11/29 01:24:16 jgg Exp $
/* ######################################################################
Acquire Method - Method helper class + functions
string Uri;
string DestFile;
time_t LastModified;
+ bool IndexFile;
};
struct FetchResult
virtual bool Fetch(FetchItem *Item) {return true;};
// Outgoing messages
- void Fail();
- void Fail(string Why);
+ void Fail(bool Transient = false);
+ void Fail(string Why, bool Transient = false);
void URIStart(FetchResult &Res);
void URIDone(FetchResult &Res,FetchResult *Alt = 0);
public:
-
- enum CnfFlags {SingleInstance = (1<<0), PreScan = (1<<1),
- Pipeline = (1<<2), SendConfig = (1<<3),
- LocalOnly = (1<<4)};
+
+ enum CnfFlags {SingleInstance = (1<<0),
+ Pipeline = (1<<1), SendConfig = (1<<2),
+ LocalOnly = (1<<3)};
void Log(const char *Format,...);
void Status(const char *Format,...);
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire-worker.cc,v 1.12 1998/11/14 01:39:44 jgg Exp $
+// $Id: acquire-worker.cc,v 1.13 1998/11/29 01:24:18 jgg Exp $
/* ######################################################################
Acquire Worker
Config->Version = LookupTag(Message,"Version");
Config->SingleInstance = StringToBool(LookupTag(Message,"Single-Instance"),false);
- Config->PreScan = StringToBool(LookupTag(Message,"Pre-Scan"),false);
Config->Pipeline = StringToBool(LookupTag(Message,"Pipeline"),false);
Config->SendConfig = StringToBool(LookupTag(Message,"Send-Config"),false);
Config->LocalOnly = StringToBool(LookupTag(Message,"Local-Only"),false);
{
clog << "Configured access method " << Config->Access << endl;
clog << "Version:" << Config->Version << " SingleInstance:" <<
- Config->SingleInstance << " PreScan: " << Config->PreScan <<
+ Config->SingleInstance <<
" Pipeline:" << Config->Pipeline << " SendConfig:" <<
Config->SendConfig << endl;
}
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire.cc,v 1.18 1998/11/23 07:32:19 jgg Exp $
+// $Id: acquire.cc,v 1.19 1998/11/29 01:24:19 jgg Exp $
/* ######################################################################
Acquire - File Acquiration
pkgAcquire::MethodConfig::MethodConfig()
{
SingleInstance = false;
- PreScan = false;
Pipeline = false;
SendConfig = false;
LocalOnly = false;
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: acquire.h,v 1.14 1998/11/23 07:32:20 jgg Exp $
+// $Id: acquire.h,v 1.15 1998/11/29 01:24:20 jgg Exp $
/* ######################################################################
Acquire - File Acquiration
string Version;
bool SingleInstance;
- bool PreScan;
bool Pipeline;
bool SendConfig;
bool LocalOnly;