]> git.ipfire.org Git - thirdparty/HylaFAX.git/commitdiff
faxq: Clieanup timeout accounting
authorAidan Van Dyk <aidan@ifax.com>
Mon, 28 Apr 2008 20:34:02 +0000 (20:34 +0000)
committerAidan Van Dyk <aidan@ifax.com>
Mon, 28 Apr 2008 20:34:02 +0000 (20:34 +0000)
Spurred on by:
| commit 0225ec9ccf5fd73cb559d4519d62b6d9842388d0
| Author: Lee Howard <faxguy@howardsilvan.com>
| Date:   Thu Oct 18 21:10:12 2007 +0000
|
|     This extends the UNSENT accounting... and it absorbs the KILLED accounting.

faxd/faxQueueApp.c++
faxd/faxQueueApp.h

index dc0b995f72df02eca74176399849de64573649f7..011ceb30aa3b2957c12cfcfea5980ae630d224a2 100644 (file)
@@ -1636,11 +1636,12 @@ faxQueueApp::sendJobDone(Job& job, FaxRequest* req)
         * be cleaned up.  Not sure if the user should be
         * notified of the requeue as well as the timeout?
         */
-       timeoutAccounting(job, *req);
+       traceQueue(job, "SEND DONE: %s, Kill time expired", (const char*)strTime(duration));
        req->result = Status(325, "Kill time expired");
        updateRequest(*req, job);
        job.state = FaxRequest::state_failed;
        deleteRequest(job, req, Job::timedout, true);
+       Trigger::post(Trigger::SEND_DONE, job);
        setDead(job);
     } else if (req->status == send_retry) {
        /*
@@ -2308,46 +2309,6 @@ faxQueueApp::delayJob(Job& job, FaxRequest& req, const Status& r, time_t tts)
     Trigger::post(Trigger::JOB_DELAYED, job);
 }
 
-void
-faxQueueApp::timeoutAccounting(Job& job, FaxRequest& req)
-{
-    FaxAcctInfo ai;
-    ai.jobid = (const char*) req.jobid;
-    ai.jobtag = (const char*) req.jobtag;
-    ai.user = (const char*) req.mailaddr;
-    ai.start = Sys::now();
-    ai.duration = 0;
-    ai.conntime = 0;
-    ai.commid = "";
-    ai.device = "";
-    ai.dest = (const char*) req.external;
-    ai.csi = "";
-    ai.npages = 0;
-    ai.params = 0;
-    ai.status = "Kill time expired";
-    CallID empty_callid;
-    ai.callid = empty_callid;
-    ai.owner = (const char*) req.owner;
-    ai.faxdcs = "";
-    pid_t pid = fork();
-    switch (pid) {
-       case -1:                        // error
-           if (!ai.record("UNSENT"))
-               logError("Error writing UNSENT accounting record, dest=%s",
-                   (const char*) ai.dest);
-           break;
-       case 0:                         // child
-           if (!ai.record("UNSENT"))
-               logError("Error writing UNSENT accounting record, dest=%s",
-                   (const char*) ai.dest);
-           _exit(255);
-           /*NOTREACHED*/
-       default:                        // parent
-           Dispatcher::instance().startChild(pid, this);
-           break;
-    }
-}
-
 /*
  * Process the job who's kill time expires.  The job is
  * terminated unless it is currently being tried, in which
@@ -2364,7 +2325,6 @@ faxQueueApp::timeoutJob(Job& job)
        job.state = FaxRequest::state_failed;
        FaxRequest* req = readRequest(job);
        if (req) {
-           timeoutAccounting(job, *req);
            req->result = Status(325, "Kill time expired");
            deleteRequest(job, req, Job::timedout, true);
        }
@@ -2389,7 +2349,6 @@ faxQueueApp::timeoutJob(Job& job, FaxRequest& req)
     job.state = FaxRequest::state_failed;
     traceQueue(job, "KILL TIME EXPIRED");
     Trigger::post(Trigger::JOB_TIMEDOUT, job);
-    timeoutAccounting(job, req);
     req.result = Status(325, "Kill time expired");
     deleteRequest(job, req, Job::timedout, true);
     setDead(job);
index d44da1214cc3ec8a3bd1e080de60ddea658d5717..8c81b98d34ad76b1148f26e7240d85f9b4cc7b77 100644 (file)
@@ -236,7 +236,6 @@ private:
     bool       submitJob(Job& job, FaxRequest& req, bool checkState = false);
     bool       suspendJob(Job& job, bool abortActive);
     bool       terminateJob(const fxStr& filename, JobStatus why);
-    void       timeoutAccounting(Job& job, FaxRequest&);
     void       timeoutJob(Job& job);
     void       timeoutJob(Job& job, FaxRequest&);
     void       runJob(Job& job);