Added EventDriverSockets.setKeepAlive.
This commit is contained in:
parent
2341762992
commit
d8f10972eb
|
@ -84,6 +84,7 @@ interface EventDriverSockets {
|
|||
void waitForConnections(StreamListenSocketFD sock, AcceptCallback on_accept);
|
||||
ConnectionState getConnectionState(StreamSocketFD sock);
|
||||
void setTCPNoDelay(StreamSocketFD socket, bool enable);
|
||||
void setKeepAlive(StreamSocketFD socket, bool enable);
|
||||
void read(StreamSocketFD socket, ubyte[] buffer, IOMode mode, IOCallback on_read_finish);
|
||||
void cancelRead(StreamSocketFD socket);
|
||||
void write(StreamSocketFD socket, const(ubyte)[] buffer, IOMode mode, IOCallback on_write_finish);
|
||||
|
|
|
@ -104,6 +104,11 @@ final class LibasyncEventDriverSockets : EventDriverSockets {
|
|||
assert(false, "TODO!");
|
||||
}
|
||||
|
||||
override void setKeepAlive(StreamSocketFD socket, bool enable)
|
||||
{
|
||||
assert(false, "TODO!");
|
||||
}
|
||||
|
||||
override void read(StreamSocketFD socket, ubyte[] buffer, IOMode mode, IOCallback on_read_finish)
|
||||
{
|
||||
assert(false, "TODO!");
|
||||
|
|
|
@ -350,6 +350,12 @@ final class PosixEventDriverSockets(Loop : PosixEventLoop) : EventDriverSockets
|
|||
() @trusted { setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, cast(char*)&opt, opt.sizeof); } ();
|
||||
}
|
||||
|
||||
final override void setKeepAlive(StreamSocketFD socket, bool enable)
|
||||
{
|
||||
ubyte opt = enable;
|
||||
() @trusted { setsockopt(socket, SOL_SOCKET, SO_KEEPALIVE, cast(char*)&opt, opt.sizeof); } ();
|
||||
}
|
||||
|
||||
final override void read(StreamSocketFD socket, ubyte[] buffer, IOMode mode, IOCallback on_read_finish)
|
||||
{
|
||||
if (buffer.length == 0) {
|
||||
|
|
|
@ -111,6 +111,11 @@ final class WinAPIEventDriverSockets : EventDriverSockets {
|
|||
assert(false, "TODO!");
|
||||
}
|
||||
|
||||
override void setKeepAlive(StreamSocketFD socket, bool enable)
|
||||
{
|
||||
assert(false, "TODO!");
|
||||
}
|
||||
|
||||
override void read(StreamSocketFD socket, ubyte[] buffer, IOMode mode, IOCallback on_read_finish)
|
||||
{
|
||||
assert(false, "TODO!");
|
||||
|
|
Loading…
Reference in a new issue