summaryrefslogtreecommitdiff
path: root/lib/ReadJob.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ReadJob.cc')
-rw-r--r--lib/ReadJob.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/ReadJob.cc b/lib/ReadJob.cc
index 3bab150..a63eeca 100644
--- a/lib/ReadJob.cc
+++ b/lib/ReadJob.cc
@@ -13,23 +13,27 @@ int ReadJob::Do() {
while (!s->IsClosed()) {
if (!current) {
+ r = 0;
try {
cerr << "Trying to read...\n";
*s >> buff;
}
catch (IOAgain e) {
cerr << "Suspending ReadJob to wait for reading...\n";
- Suspend();
+ r = 1;
}
+ if (r) Suspend();
cerr << "Read some bytes...\n";
}
+ r = 0;
try {
*d << buff << endnl;
}
catch (IOAgain e) {
cerr << "Suspending ReadJob to wait for writing...\n";
- Suspend();
+ r = 1;
}
+ if (r) Suspend();
cerr << "Wrote some bytes...\n";
if (buff == "") return TASK_DONE;
}