summaryrefslogtreecommitdiff
path: root/includes/ZHandle.h
diff options
context:
space:
mode:
authorNicolas 'Pixel' Noble <pixel@nobis-crew.org>2013-01-21 00:53:12 -0800
committerNicolas 'Pixel' Noble <pixel@nobis-crew.org>2013-01-21 00:53:12 -0800
commit56b8ca62c666a1b747766a5ede70db070977ad37 (patch)
tree9d541e2d5a86ace3d1939aeec384d61bc0ae73ae /includes/ZHandle.h
parentc4882ea5aae8b1ad0fce85e19844a1c2ef97aa28 (diff)
ZStreams's close, read and write are now fully interruptible. Will need some testing though.
Diffstat (limited to 'includes/ZHandle.h')
-rw-r--r--includes/ZHandle.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/includes/ZHandle.h b/includes/ZHandle.h
index 5750365..8164853 100644
--- a/includes/ZHandle.h
+++ b/includes/ZHandle.h
@@ -2,6 +2,7 @@
#include <zlib.h>
#include <Handle.h>
+#include <Async.h>
namespace Balau {
@@ -24,13 +25,28 @@ class ZStream : public Handle {
void detach() { m_detached = true; }
void flush() { doFlush(false); }
void setUseAsyncOp(bool useAsyncOp) { m_useAsyncOp = useAsyncOp; }
- private:
+ virtual bool isPendingComplete();
void finish() { doFlush(true); }
void doFlush(bool finish);
+ private:
IO<Handle> m_h;
z_stream m_zin, m_zout;
String m_name;
- uint8_t * m_in = NULL;
+ uint8_t * m_buf = NULL;
+ uint8_t * m_wptr;
+ enum {
+ IDLE,
+ READING,
+ WRITING,
+ COMPRESSING,
+ COMPRESSING_IDLE,
+ DECOMPRESSING,
+ DECOMPRESSING_IDLE,
+ CLOSING,
+ } m_phase = IDLE;
+ size_t m_total, m_count, m_compressed;
+ AsyncOperation * m_op = NULL;
+ ssize_t m_status;
bool m_detached = false, m_closed = false, m_eof = false, m_useAsyncOp = true;
};