Skip to content

Commit 5535291

Browse files
committed
Add support for "abstract unix socket"
1 parent 7bb12a1 commit 5535291

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

uvloop/handles/pipe.pxd

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ cdef class UnixTransport(UVStream):
1616
cdef UnixTransport new(Loop loop, object protocol, Server server,
1717
object waiter, object context)
1818

19-
cdef connect(self, char* addr)
19+
cdef connect(self, const char* name, size_t namelen)
2020

2121

2222
cdef class ReadUnixTransport(UVStream):

uvloop/handles/pipe.pyx

+7-6
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ cdef class UnixTransport(UVStream):
121121
cdef _open(self, int sockfd):
122122
__pipe_open(<UVStream>self, sockfd)
123123

124-
cdef connect(self, char* addr):
124+
cdef connect(self, const char* name, size_t namelen):
125125
cdef _PipeConnectRequest req
126126
req = _PipeConnectRequest(self._loop, self)
127-
req.connect(addr)
127+
req.connect(name, namelen)
128128

129129

130130
@cython.no_gc_clear
@@ -216,11 +216,12 @@ cdef class _PipeConnectRequest(UVRequest):
216216
self.request.data = <void*>self
217217
self.transport = transport
218218

219-
cdef connect(self, char* addr):
220-
# uv_pipe_connect returns void
221-
uv.uv_pipe_connect(<uv.uv_connect_t*>self.request,
219+
cdef connect(self, const char* name, size_t namelen):
220+
uv.uv_pipe_connect2(<uv.uv_connect_t*>self.request,
222221
<uv.uv_pipe_t*>self.transport._handle,
223-
addr,
222+
name,
223+
namelen,
224+
0,
224225
__pipe_connect_callback)
225226

226227
cdef void __pipe_connect_callback(

uvloop/includes/uv.pxd

+3-2
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,9 @@ cdef extern from "uv.h" nogil:
381381
int uv_pipe_open(uv_pipe_t* handle, uv_os_fd_t file)
382382
int uv_pipe_bind(uv_pipe_t* handle, const char* name)
383383

384-
void uv_pipe_connect(uv_connect_t* req, uv_pipe_t* handle,
385-
const char* name, uv_connect_cb cb)
384+
void uv_pipe_connect2(uv_connect_t* req, uv_pipe_t* handle,
385+
const char* name, size_t namelen,
386+
unsigned int flags, uv_connect_cb cb)
386387

387388
# UDP
388389

uvloop/loop.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2283,7 +2283,7 @@ cdef class Loop:
22832283

22842284
waiter = self._new_future()
22852285
tr = UnixTransport.new(self, protocol, None, waiter, context)
2286-
tr.connect(path)
2286+
tr.connect(path, len(path))
22872287
try:
22882288
await waiter
22892289
except (KeyboardInterrupt, SystemExit):

0 commit comments

Comments
 (0)