Skip to content

Commit 7d9583d

Browse files
committed
Fix UDPSocket#bind to specify family and socktype when resolving address
PullRequest: truffleruby/718
2 parents 5a963ee + feb0b78 commit 7d9583d

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ Changes:
1010
unsupported, have been removed.
1111
* Our experimental JRuby-compatible Java interop has been removed - use
1212
`Polyglot` and `Java` instead.
13+
1314
Bug fixes:
1415

1516
* `autoload :C, "path"; require "path"` now correctly triggers the autoload.
17+
* Fixed `UDPSocket#bind` to specify family and socktype when resolving address.
1618

1719
# 1.0 RC 14
1820

lib/truffle/socket/udp_socket.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ def initialize(family = Socket::AF_INET)
3939
end
4040

4141
def bind(host, port)
42-
addr = Socket.sockaddr_in(port.to_i, host)
42+
addr = Truffle::Socket::Foreign.pack_sockaddr_in(
43+
host, port.to_i, @family, Socket::SOCK_DGRAM, 0)
4344
status = Truffle::Socket::Foreign.bind(descriptor, addr)
4445

4546
Errno.handle('bind(2)') if status < 0
@@ -48,8 +49,8 @@ def bind(host, port)
4849
end
4950

5051
def connect(host, port)
51-
sockaddr = Truffle::Socket::Foreign
52-
.pack_sockaddr_in(host, port.to_i, @family, Socket::SOCK_DGRAM, 0)
52+
sockaddr = Truffle::Socket::Foreign.pack_sockaddr_in(
53+
host, port.to_i, @family, Socket::SOCK_DGRAM, 0)
5354

5455
status = Truffle::Socket::Foreign.connect(descriptor, sockaddr)
5556

spec/tags/library/socket/udpsocket/send_tags.txt

Lines changed: 0 additions & 4 deletions
This file was deleted.

test/mri/excludes/TestFileExhaustive.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@
1818
exclude :test_sticky, "needs investigation"
1919
exclude :test_suid, "needs investigation"
2020
exclude :test_test, "needs investigation"
21+
exclude :test_flock_exclusive, "spurious on macOS"
22+
exclude :test_flock_shared, "spurious on macOS"

0 commit comments

Comments
 (0)