Skip to content

Commit 3fb1441

Browse files
author
KJ Tsanaktsidis
committed
Fix missing passing of the IO object
1 parent e283349 commit 3fb1441

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

ext/socket/udpsocket.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ udp_connect(VALUE sock, VALUE host, VALUE port)
8888

8989
GetOpenFile(sock, fptr);
9090
arg.res = rsock_addrinfo(host, port, rsock_fd_family(fptr->fd), SOCK_DGRAM, 0);
91+
arg.io = sock;
9192
ret = rb_ensure(udp_connect_internal, (VALUE)&arg,
9293
rsock_freeaddrinfo, (VALUE)arg.res);
9394
if (!ret) rsock_sys_fail_host_port("connect(2)", host, port);
@@ -134,6 +135,7 @@ udp_bind(VALUE sock, VALUE host, VALUE port)
134135

135136
GetOpenFile(sock, fptr);
136137
arg.res = rsock_addrinfo(host, port, rsock_fd_family(fptr->fd), SOCK_DGRAM, 0);
138+
arg.io = sock;
137139
ret = rb_ensure(udp_bind_internal, (VALUE)&arg,
138140
rsock_freeaddrinfo, (VALUE)arg.res);
139141
if (!ret) rsock_sys_fail_host_port("bind(2)", host, port);

ext/socket/unixsocket.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ rsock_init_unixsock(VALUE io, VALUE path, int server)
7373
}
7474

7575
rsock_init_sock(io, fd);
76-
RB_IO_OPEN(io, fptr);
76+
GetOpenFile(io, fptr);
7777

7878
if (server) {
7979
status = bind(fd, (struct sockaddr*)&sockaddr, sockaddrlen);
@@ -83,6 +83,7 @@ rsock_init_unixsock(VALUE io, VALUE path, int server)
8383
struct unixsock_arg arg;
8484
arg.sockaddr = &sockaddr;
8585
arg.sockaddrlen = sockaddrlen;
86+
arg.io = io;
8687

8788
status = (int)rb_protect(unixsock_connect_internal, (VALUE)&arg, &error_tag);
8889

0 commit comments

Comments
 (0)