summaryrefslogtreecommitdiff
path: root/lib/Handle.cc
diff options
context:
space:
mode:
authorPixel <Pixel>2001-12-21 12:28:23 +0000
committerPixel <Pixel>2001-12-21 12:28:23 +0000
commit07447744c6b3455c1703471b249bda89dba333f5 (patch)
tree59be10e6e9a7dcc9e2e5efb6d4300e355874dad1 /lib/Handle.cc
parent0562cba38dddc4bbf33b727245f6efab20eb9dac (diff)
Handling bug in read!@#!@#!@#
Diffstat (limited to 'lib/Handle.cc')
-rw-r--r--lib/Handle.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Handle.cc b/lib/Handle.cc
index 010fce9..e98b2c7 100644
--- a/lib/Handle.cc
+++ b/lib/Handle.cc
@@ -46,6 +46,7 @@ ssize_t Handle::write(const void *buf, size_t count) throw (GeneralException) {
done = false;
full = true;
if (nonblock) {
+ cerr << "write: throwing IOAgain for handle " << GetName() << endl;
throw IOAgain();
} else {
sleep(1);
@@ -68,11 +69,14 @@ ssize_t Handle::read(void *buf, size_t count) throw (GeneralException) {
ssize_t r;
errno = 0;
- if ((r = uread(buf, count)) < 0) {
+ while ((r = uread(buf, count)) < 0) {
if ((!errno) || (errno == EAGAIN) || (errno == EINTR)) {
// Avant de déclarer une erreur, on vérifie si ce n'est pas un
// problème lié au fait qu'il n'y a plus d'octets.
- throw IOAgain();
+ if (nonblock) {
+ cerr << "read: throwing IOAgain for handle " << GetName() << endl;
+ throw IOAgain();
+ }
} else {
throw IOException(GetName(), IO_READ, count);
}