Skip to content

Add support for "abstract unix socket" #659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion uvloop/handles/pipe.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ cdef class UnixTransport(UVStream):
cdef UnixTransport new(Loop loop, object protocol, Server server,
object waiter, object context)

cdef connect(self, char* addr)
cdef connect(self, const char* name, size_t namelen)


cdef class ReadUnixTransport(UVStream):
Expand Down
13 changes: 7 additions & 6 deletions uvloop/handles/pipe.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ cdef class UnixTransport(UVStream):
cdef _open(self, int sockfd):
__pipe_open(<UVStream>self, sockfd)

cdef connect(self, char* addr):
cdef connect(self, const char* name, size_t namelen):
cdef _PipeConnectRequest req
req = _PipeConnectRequest(self._loop, self)
req.connect(addr)
req.connect(name, namelen)


@cython.no_gc_clear
Expand Down Expand Up @@ -216,11 +216,12 @@ cdef class _PipeConnectRequest(UVRequest):
self.request.data = <void*>self
self.transport = transport

cdef connect(self, char* addr):
# uv_pipe_connect returns void
uv.uv_pipe_connect(<uv.uv_connect_t*>self.request,
cdef connect(self, const char* name, size_t namelen):
uv.uv_pipe_connect2(<uv.uv_connect_t*>self.request,
<uv.uv_pipe_t*>self.transport._handle,
addr,
name,
namelen,
0,
__pipe_connect_callback)

cdef void __pipe_connect_callback(
Expand Down
5 changes: 3 additions & 2 deletions uvloop/includes/uv.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,9 @@ cdef extern from "uv.h" nogil:
int uv_pipe_open(uv_pipe_t* handle, uv_os_fd_t file)
int uv_pipe_bind(uv_pipe_t* handle, const char* name)

void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
const char* name, uv_connect_cb cb)
void uv_pipe_connect2(uv_connect_t* req, uv_pipe_t* handle,
const char* name, size_t namelen,
unsigned int flags, uv_connect_cb cb)

# UDP

Expand Down
2 changes: 1 addition & 1 deletion uvloop/loop.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2283,7 +2283,7 @@ cdef class Loop:

waiter = self._new_future()
tr = UnixTransport.new(self, protocol, None, waiter, context)
tr.connect(path)
tr.connect(path, len(path))
try:
await waiter
except (KeyboardInterrupt, SystemExit):
Expand Down
Loading