aboutsummaryrefslogtreecommitdiff
path: root/source/tanya/async/watcher.d
diff options
context:
space:
mode:
Diffstat (limited to 'source/tanya/async/watcher.d')
-rw-r--r--source/tanya/async/watcher.d74
1 files changed, 0 insertions, 74 deletions
diff --git a/source/tanya/async/watcher.d b/source/tanya/async/watcher.d
index 997e033..9756d99 100644
--- a/source/tanya/async/watcher.d
+++ b/source/tanya/async/watcher.d
@@ -115,77 +115,3 @@ class ConnectionWatcher : SocketWatcher
}
}
}
-
-package abstract class IOWatcher : SocketWatcher, DuplexTransport
-{
- package SocketException exception;
-
- package ReadBuffer!ubyte output;
-
- package WriteBuffer!ubyte input;
-
- /// Application protocol.
- protected Protocol protocol_;
-
- /**
- * Params:
- * socket = Socket.
- *
- * Precondition: $(D_INLINECODE socket !is null)
- */
- this(ConnectedSocket socket) @nogc
- {
- super(socket);
- output = ReadBuffer!ubyte(8192, 1024, MmapPool.instance);
- input = WriteBuffer!ubyte(8192, MmapPool.instance);
- active = true;
- }
-
- /**
- * Returns: Application protocol.
- */
- @property Protocol protocol() pure nothrow @safe @nogc
- {
- return protocol_;
- }
-
- /**
- * Switches the protocol.
- *
- * The protocol is deallocated by the event loop, it should currently be
- * allocated with $(D_PSYMBOL MmapPool).
- *
- * Params:
- * protocol = Application protocol.
- *
- * Precondition: $(D_INLINECODE protocol !is null)
- */
- @property void protocol(Protocol protocol) pure nothrow @safe @nogc
- in
- {
- assert(protocol !is null);
- }
- body
- {
- protocol_ = protocol;
- }
-
- /**
- * Invokes the watcher callback.
- */
- override void invoke() @nogc
- {
- if (output.length)
- {
- protocol.received(output[0 .. $]);
- output.clear();
- }
- else
- {
- protocol.disconnected(exception);
- MmapPool.instance.dispose(protocol_);
- defaultAllocator.dispose(exception);
- active = false;
- }
- }
-}