summaryrefslogtreecommitdiff
path: root/lib/ReadJob.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ReadJob.cc')
-rw-r--r--lib/ReadJob.cc11
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/ReadJob.cc b/lib/ReadJob.cc
index f2749bb..6fab08b 100644
--- a/lib/ReadJob.cc
+++ b/lib/ReadJob.cc
@@ -2,8 +2,8 @@
#include "HttpServ.h"
ReadJob::ReadJob(Handle * as, Handle * ad) : s(as), d(ad) {
- WaitFor(s, W4_STICKY);
- WaitFor(d, W4_STICKY);
+ WaitFor(s, W4_STICKY | W4_READING);
+ WaitFor(d, W4_STICKY | W4_WRITING);
}
ReadJob::~ReadJob() { }
@@ -11,30 +11,23 @@ ReadJob::~ReadJob() { }
int ReadJob::Do() throw (GeneralException) {
String buff;
- cerr << "ReadJob running...\n";
-
switch (current) {
case 0:
try {
- cerr << "Trying to read...\n";
*s >> buff;
}
catch (IOAgain e) {
- cerr << "Suspending ReadJob to wait for reading...\n";
throw TaskSwitch();
}
- cerr << "Read some bytes...\n";
case 1:
try {
*d << buff << endnl;
}
catch (IOAgain e) {
- cerr << "Suspending ReadJob to wait for writing...\n";
current = 1;
throw TaskSwitch();
}
current = 0;
- cerr << "Wrote some bytes...\n";
if (buff == "") return TASK_DONE;
}