Add scalar type template parameter for buffers

This commit is contained in:
2016-12-19 21:24:28 +01:00
parent f1bc4dc2e2
commit e32af2d09e
5 changed files with 582 additions and 573 deletions

View File

@@ -30,7 +30,7 @@ class IOCPStreamTransport : StreamTransport
{
private OverlappedConnectedSocket socket_;
private WriteBuffer input;
private WriteBuffer!ubyte input;
/**
* Creates new completion port transport.
@@ -45,12 +45,7 @@ class IOCPStreamTransport : StreamTransport
body
{
socket_ = socket;
input = MmapPool.instance.make!WriteBuffer(8192, MmapPool.instance);
}
~this()
{
MmapPool.instance.dispose(input);
input = WriteBuffer!ubyte(8192, MmapPool.instance);
}
@property inout(OverlappedConnectedSocket) socket()

View File

@@ -30,7 +30,7 @@ class SelectorStreamTransport : StreamTransport
private ConnectedSocket socket_;
/// Input buffer.
package WriteBuffer input;
package WriteBuffer!ubyte input;
private SelectorLoop loop;
@@ -46,15 +46,7 @@ class SelectorStreamTransport : StreamTransport
{
socket_ = socket;
this.loop = loop;
input = MmapPool.instance.make!WriteBuffer(8192, MmapPool.instance);
}
/**
* Close the transport and deallocate the data buffers.
*/
~this() @nogc
{
MmapPool.instance.dispose(input);
input = WriteBuffer!ubyte(8192, MmapPool.instance);
}
/**

View File

@@ -139,7 +139,7 @@ class IOWatcher : ConnectionWatcher
/**
* Returns: Underlying output buffer.
*/
package ReadBuffer output;
package ReadBuffer!ubyte output;
/**
* Params:
@@ -157,7 +157,7 @@ class IOWatcher : ConnectionWatcher
super();
transport_ = transport;
protocol_ = protocol;
output = MmapPool.instance.make!ReadBuffer(8192, 1024, MmapPool.instance);
output = ReadBuffer!ubyte(8192, 1024, MmapPool.instance);
active = true;
}
@@ -166,7 +166,6 @@ class IOWatcher : ConnectionWatcher
*/
protected ~this() @nogc
{
MmapPool.instance.dispose(output);
MmapPool.instance.dispose(protocol_);
}