diff options
Diffstat (limited to 'lib/Handle.cc')
-rw-r--r-- | lib/Handle.cc | 8 |
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); } |