From 672e1c951d3b48c64c9b67c68b7d852292f30d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6nke=20Ludwig?= Date: Sun, 15 Jan 2017 21:59:15 +0100 Subject: [PATCH] Adjust high level wrapper and test. --- source/eventcore/socket.d | 8 ++++---- tests/0-tcp.d | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/eventcore/socket.d b/source/eventcore/socket.d index 456b7ff..328ddfa 100644 --- a/source/eventcore/socket.d +++ b/source/eventcore/socket.d @@ -93,9 +93,9 @@ struct StreamListenSocket { void waitForConnections(alias callback)(ref StreamListenSocket socket) { - void cb(StreamListenSocketFD, StreamSocketFD sock) @safe nothrow { + void cb(StreamListenSocketFD, StreamSocketFD sock, scope RefAddress addr) @safe nothrow { auto ss = StreamSocket(sock); - callback(ss); + callback(ss, addr); } eventDriver.sockets.waitForConnections(socket.m_fd, &cb); } @@ -116,14 +116,14 @@ struct DatagramSocket { } void receive(alias callback)(ref DatagramSocket socket, ubyte[] buffer, IOMode mode) { - void cb(DatagramSocketFD fd, IOStatus status, size_t bytes_written, scope Address address) @safe nothrow { + void cb(DatagramSocketFD fd, IOStatus status, size_t bytes_written, scope RefAddress address) @safe nothrow { callback(status, bytes_written, address); } eventDriver.sockets.receive(socket.m_fd, buffer, mode, &cb); } void cancelReceive(ref DatagramSocket socket) { eventDriver.sockets.cancelReceive(socket.m_fd); } void send(alias callback)(ref DatagramSocket socket, const(ubyte)[] buffer, IOMode mode, Address target_address = null) { - void cb(DatagramSocketFD fd, IOStatus status, size_t bytes_written, scope Address) @safe nothrow { + void cb(DatagramSocketFD fd, IOStatus status, size_t bytes_written, scope RefAddress) @safe nothrow { callback(status, bytes_written); } eventDriver.sockets.send(socket.m_fd, buffer, mode, target_address, &cb); diff --git a/tests/0-tcp.d b/tests/0-tcp.d index 39211a1..2af5885 100644 --- a/tests/0-tcp.d +++ b/tests/0-tcp.d @@ -22,7 +22,7 @@ void main() StreamSocket client; StreamSocket incoming; - server.waitForConnections!((incoming_) { + server.waitForConnections!((incoming_, addr) { incoming = incoming_; // work around ref counting issue incoming.read!((status, bts) { assert(status == IOStatus.ok);