[Issue 20544] New: socket.remoteAddress throws out of memory error with unix domain socket peer

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 29 16:26:14 UTC 2020


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 at puremagic.com
          Reporter: destructionator at 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

--


More information about the Digitalmars-d-bugs mailing list