Commit 066cd181 authored by David COME's avatar David COME
Browse files

Fixed a bug : a client could have had some reports after a reportEndOfSession(WithErrors)

parent 1a0bc364
......@@ -145,24 +145,17 @@ m_parent(parent) {
}
void RecallReportPacker::WorkerThread::run(){
while(m_parent.m_continue) {
std::auto_ptr<Report> rep (m_parent.m_fifo.pop());
rep->execute(m_parent);
while(m_parent.m_continue) {
std::auto_ptr<Report> rep (m_parent.m_fifo.pop());
unsigned int totalSize = m_parent.m_listReports->failedRecalls().size() +
m_parent.m_listReports->successfulRecalls().size();
if(totalSize >= m_parent.m_reportFilePeriod)
if(totalSize >= m_parent.m_reportFilePeriod || true==rep->goingToEnd())
{
m_parent.flush();
}
rep->execute(m_parent);
}
/*
* we might have stored into m_parent.m_listReports some reports between
* the last flush and the End of session but not reached the critical mass
* required to flush. So we unconditionally flush
*/
m_parent.flush();
}
}}}}
......@@ -73,15 +73,18 @@ public:
private:
class Report {
const bool m_endNear;
public:
Report(bool b):m_endNear(b){}
virtual ~Report(){}
virtual void execute(RecallReportPacker& packer)=0;
bool goingToEnd() const {return m_endNear;};
};
class ReportSuccessful : public Report {
const FileStruct m_migratedFile;
public:
ReportSuccessful(const FileStruct& file):
m_migratedFile(file){}
Report(false),m_migratedFile(file){}
virtual void execute(RecallReportPacker& _this);
};
class ReportError : public Report {
......@@ -90,12 +93,13 @@ private:
const int m_error_code;
public:
ReportError(const FileStruct& file,std::string msg,int error_code):
m_migratedFile(file),m_error_msg(msg),m_error_code(error_code){}
Report(false),m_migratedFile(file),m_error_msg(msg),m_error_code(error_code){}
virtual void execute(RecallReportPacker& _this);
};
class ReportEndofSession : public Report {
public:
ReportEndofSession():Report(false){}
virtual void execute(RecallReportPacker& _this);
};
class ReportEndofSessionWithErrors : public Report {
......@@ -103,7 +107,7 @@ private:
int m_error_code;
public:
ReportEndofSessionWithErrors(std::string msg,int error_code):
m_message(msg),m_error_code(error_code){}
Report(false),m_message(msg),m_error_code(error_code){}
virtual void execute(RecallReportPacker& _this);
};
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment