Add scalar type template parameter for buffers
This commit is contained in:
parent
f1bc4dc2e2
commit
e32af2d09e
@ -30,7 +30,7 @@ class IOCPStreamTransport : StreamTransport
|
|||||||
{
|
{
|
||||||
private OverlappedConnectedSocket socket_;
|
private OverlappedConnectedSocket socket_;
|
||||||
|
|
||||||
private WriteBuffer input;
|
private WriteBuffer!ubyte input;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new completion port transport.
|
* Creates new completion port transport.
|
||||||
@ -45,12 +45,7 @@ class IOCPStreamTransport : StreamTransport
|
|||||||
body
|
body
|
||||||
{
|
{
|
||||||
socket_ = socket;
|
socket_ = socket;
|
||||||
input = MmapPool.instance.make!WriteBuffer(8192, MmapPool.instance);
|
input = WriteBuffer!ubyte(8192, MmapPool.instance);
|
||||||
}
|
|
||||||
|
|
||||||
~this()
|
|
||||||
{
|
|
||||||
MmapPool.instance.dispose(input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@property inout(OverlappedConnectedSocket) socket()
|
@property inout(OverlappedConnectedSocket) socket()
|
||||||
|
@ -30,7 +30,7 @@ class SelectorStreamTransport : StreamTransport
|
|||||||
private ConnectedSocket socket_;
|
private ConnectedSocket socket_;
|
||||||
|
|
||||||
/// Input buffer.
|
/// Input buffer.
|
||||||
package WriteBuffer input;
|
package WriteBuffer!ubyte input;
|
||||||
|
|
||||||
private SelectorLoop loop;
|
private SelectorLoop loop;
|
||||||
|
|
||||||
@ -46,15 +46,7 @@ class SelectorStreamTransport : StreamTransport
|
|||||||
{
|
{
|
||||||
socket_ = socket;
|
socket_ = socket;
|
||||||
this.loop = loop;
|
this.loop = loop;
|
||||||
input = MmapPool.instance.make!WriteBuffer(8192, MmapPool.instance);
|
input = WriteBuffer!ubyte(8192, MmapPool.instance);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Close the transport and deallocate the data buffers.
|
|
||||||
*/
|
|
||||||
~this() @nogc
|
|
||||||
{
|
|
||||||
MmapPool.instance.dispose(input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -139,7 +139,7 @@ class IOWatcher : ConnectionWatcher
|
|||||||
/**
|
/**
|
||||||
* Returns: Underlying output buffer.
|
* Returns: Underlying output buffer.
|
||||||
*/
|
*/
|
||||||
package ReadBuffer output;
|
package ReadBuffer!ubyte output;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Params:
|
* Params:
|
||||||
@ -157,7 +157,7 @@ class IOWatcher : ConnectionWatcher
|
|||||||
super();
|
super();
|
||||||
transport_ = transport;
|
transport_ = transport;
|
||||||
protocol_ = protocol;
|
protocol_ = protocol;
|
||||||
output = MmapPool.instance.make!ReadBuffer(8192, 1024, MmapPool.instance);
|
output = ReadBuffer!ubyte(8192, 1024, MmapPool.instance);
|
||||||
active = true;
|
active = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +166,6 @@ class IOWatcher : ConnectionWatcher
|
|||||||
*/
|
*/
|
||||||
protected ~this() @nogc
|
protected ~this() @nogc
|
||||||
{
|
{
|
||||||
MmapPool.instance.dispose(output);
|
|
||||||
MmapPool.instance.dispose(protocol_);
|
MmapPool.instance.dispose(protocol_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -54,10 +54,9 @@ interface Allocator
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The mixin generates common methods for classes and structs using
|
* The mixin generates common methods for classes and structs using
|
||||||
* allocators. It provides a protected member, constructor and a read-only
|
* allocators. It provides a protected member, constructor and a read-only property,
|
||||||
* property, that checks if an allocator was already set and sets it to the
|
* that checks if an allocator was already set and sets it to the default
|
||||||
* default one, if not (useful for structs which don't have a default
|
* one, if not (useful for structs which don't have a default constructor).
|
||||||
* constructor).
|
|
||||||
*/
|
*/
|
||||||
mixin template DefaultAllocator()
|
mixin template DefaultAllocator()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user