Skip to content

x/sys/windows: fix Accept implementation #54212

@x1unix

Description

@x1unix

Currently windows.Accept (like syscall.Accept for GOOS=windows) contains a stub function which does nothing.

Looks like this function was introduced to mimic unix.Sockaddr.Accept method but it's just a useless stub.

I propose to fix its signature and re-implement it as winsock's accept function.

In the end it will look something like this:

package windows

func Accept(fd windows.Handle, sockaddr, sockaddrLen uintptr)

Winsock accept function signature (see MSDN)

SOCKET WSAAPI accept(
  [in]      SOCKET   s,
  [out]     sockaddr *addr,
  [in, out] int      *addrlen
);

Instead of passing sockaddr raw pointer and it's size it's possible to also use Sockaddr interface and the same approach like in windows.Bind but it will limit method's potential use cases (it can't be used for custom sockets). See #54209.

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsFixThe path to resolution is known, but the work has not been done.OS-Windows

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions