www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20544] New: socket.remoteAddress throws out of memory error

https://issues.dlang.org/show_bug.cgi?id=20544

          Issue ID: 20544
           Summary: socket.remoteAddress throws out of memory error with
                    unix domain socket peer
           Product: D
           Version: D2
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: destructionator gmail.com

see:

import std.socket;
import std.stdio;
import std.concurrency;

void client() {
        auto socket = new Socket(AddressFamily.UNIX, SocketType.STREAM);
        socket.connect(new UnixAddress("\0test"));
        ubyte[128] buffer;
        socket.receive(buffer[]);
        socket.close();
}

void main() {
        auto socket = new Socket(AddressFamily.UNIX, SocketType.STREAM);
        socket.bind(new UnixAddress("\0test"));
        socket.listen(1);
        spawn(&client);
        auto peer = socket.accept();

        scope(exit) {
                peer.send("");
                peer.close();
                socket.close();
        }

        writeln(peer.remoteAddress());
}


PR: https://github.com/dlang/phobos/pull/7383

--
Jan 29