diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/HttpServ.cc | 9 | ||||
-rw-r--r-- | lib/Task.cc | 4 | ||||
-rw-r--r-- | lib/TaskMan.cc | 8 |
3 files changed, 17 insertions, 4 deletions
diff --git a/lib/HttpServ.cc b/lib/HttpServ.cc index 8b28878..75b6800 100644 --- a/lib/HttpServ.cc +++ b/lib/HttpServ.cc @@ -65,14 +65,14 @@ int ProcessRequest::Do() { len = -1; do { b >> t; - cerr << "Read Request (n): " << t << endl; + // cerr << "Read Request (n): " << t << endl; if ((t.strstr("Content-Length: ") == 0) || (t.strstr("Content-length: ") == 0)) { cerr << "Saw 'Content-Lenght:', reading length from '" << t.extract(16) << "'\n"; len = t.extract(16).to_int(); } } while (t.strlen()); - cerr << "---- Processing it.\n"; + // cerr << "---- Processing it.\n"; hasvars = false; @@ -163,7 +163,7 @@ int ProcessRequest::Do() { if (a) a->Stop(); delete Vars; - cerr << "---- Sending header buffer.\n"; + // cerr << "---- Sending header buffer.\n"; c = new CopyJob(&b, &s, -1, false); WaitFor(c); current = 3; @@ -173,7 +173,7 @@ int ProcessRequest::Do() { delete c; if (a) { - cerr << "---- Sending contents.\n"; + // cerr << "---- Sending contents.\n"; a->Restart(); WaitFor(a); current = 4; @@ -344,6 +344,7 @@ void ProcessRequest::SendHeads(Handle * s, const String & mime, const String & e strftime(buf, 1024, "%a, %d %b %Y %H:%M:%S GMT", ft); } *s << "Last-Modified: " << buf << endhl << extra << + "Cache-Control: no-cache" << endhl << "Keep-Alive: timeout=0, max=0" << endhl << "Connection: Keep-Alive" << endhl << "Content-Type: " << mime << endhl << endhl; diff --git a/lib/Task.cc b/lib/Task.cc index 9ed1589..60a9872 100644 --- a/lib/Task.cc +++ b/lib/Task.cc @@ -17,16 +17,20 @@ int Task::Do() throw (GeneralException) { } int Task::Run() { + cerr << "==== Task: \"" << GetName() << "\" running.\n"; try { state = Do(); } catch (TaskSwitch) { + cerr << "==== Task: \"" << GetName() << "\" caugh a task switch. returning " << (state == TASK_ON_HOLD ? "TASK_ON_HOLD" : "TASK_DONE") << endl; return state; } catch (GeneralException e) { + cerr << "Task " << GetName() << " caused an unexpected exception. Terminating.\n"; return TASK_DONE; } + cerr << "==== Task: \"" << GetName() << "\" exitted. returning " << (state == TASK_ON_HOLD ? "TASK_ON_HOLD" : "TASK_DONE") << endl; return state; } diff --git a/lib/TaskMan.cc b/lib/TaskMan.cc index 97fd1bd..218ce2f 100644 --- a/lib/TaskMan.cc +++ b/lib/TaskMan.cc @@ -120,6 +120,8 @@ void TaskMan::MainLoop() throw (GeneralException) { throw GeneralException("TaskMan: No more task to manage."); } + cerr << "==== TaskMan: main loop.\n"; + no_burst = 0; while (!no_burst) { no_burst = 1; @@ -128,6 +130,7 @@ void TaskMan::MainLoop() throw (GeneralException) { Task * t = *p; if (t->GetState() == TASK_BURST) { + cerr << "==== TaskMan: running burning task \"" << t->GetName() << "\".\n"; t->Run(); /* if the task added some new tasks, we have to rerun the loop */ no_burst = 0; @@ -151,6 +154,8 @@ void TaskMan::MainLoop() throw (GeneralException) { nfds = w4ha.size(); + cerr << "==== TaskMan: polling.\n"; + if (nfds != 0) { int r; vector<w4ha_t>::iterator p; @@ -168,6 +173,7 @@ void TaskMan::MainLoop() throw (GeneralException) { q->fd = 0; q->events = 0; } else { + cerr << "==== TaskMan: adding watch over handle \"" << p->ha->GetName() << "\" for task \"" << p->T->GetName() << "\"\n"; q->fd = p->ha->GetHandle(); q->events = (p->flags & W4_READING ? POLLIN : 0) | (p->flags & W4_WRITING ? POLLOUT : 0); } @@ -231,6 +237,8 @@ void TaskMan::MainLoop() throw (GeneralException) { if ((p->ha->GetHandle() == fd) && (!p->T->IsStopped())) { // We've got one, launch it. bool erased; + + cerr << "==== TaskMan: event over handle \"" << p->ha->GetName() << "\"\n"; erased = false; p->T->Run(); |