mirror of
https://github.com/vlang/v.git
synced 2025-09-15 23:42:28 +03:00
net: ensure that net
and net.unix
can be imported together in the same program
This commit is contained in:
parent
14073ac0fe
commit
c9867a9ae4
9 changed files with 81 additions and 101 deletions
|
@ -62,7 +62,7 @@ fn (mut s StreamSocket) connect(a string) ? {
|
|||
}
|
||||
mut addr := C.sockaddr_un{}
|
||||
unsafe { C.memset(&addr, 0, sizeof(C.sockaddr_un)) }
|
||||
addr.sun_family = C.AF_UNIX
|
||||
addr.sun_family = u16(C.AF_UNIX)
|
||||
unsafe { C.strncpy(&addr.sun_path[0], &char(a.str), max_sun_path) }
|
||||
size := C.SUN_LEN(&addr)
|
||||
res := C.connect(s.handle, voidptr(&addr), size)
|
||||
|
@ -94,7 +94,7 @@ pub fn listen_stream(sock string) ?&StreamListener {
|
|||
s.path = sock
|
||||
mut addr := C.sockaddr_un{}
|
||||
unsafe { C.memset(&addr, 0, sizeof(C.sockaddr_un)) }
|
||||
addr.sun_family = C.AF_UNIX
|
||||
addr.sun_family = u16(C.AF_UNIX)
|
||||
unsafe { C.strncpy(&addr.sun_path[0], &char(sock.str), max_sun_path) }
|
||||
size := C.SUN_LEN(&addr)
|
||||
if os.exists(sock) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue