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);