Skip to content

Commit 0124b94

Browse files
committed
Fix TCPServer#accept to set #do_not_reverse_lookup correctly on the created TCPSocket
1 parent 07b8026 commit 0124b94

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Bug fixes:
1414
* Implemented `FFI::Pointer#clear` (#1687).
1515
* Procs will now yield to the block in their declaration context even when called with a block argument (#1657).
1616
* Fixed problems with calling POSIX methods if `Symbol#[]` is redefined (#1665).
17+
* Fix `TCPServer#accept` to set `#do_not_reverse_lookup` correctly on the created `TCPSocket`.
1718

1819
Compatibility
1920

lib/truffle/socket/basic_socket.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626

2727
class BasicSocket < IO
28-
def self.for_fd(fixnum)
28+
def self.for_fd(fd)
2929
sock = allocate
3030

31-
IO.setup(sock, fixnum, nil, true)
31+
IO.setup(sock, fd, nil, true)
3232
sock.binmode
3333
# TruffleRuby: start
3434
sock.do_not_reverse_lookup = do_not_reverse_lookup

lib/truffle/socket/truffle.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,7 @@ def self.accept(source, new_class)
8181

8282
Error.read_error('accept(2)', source) if fd < 0
8383

84-
socket = new_class.allocate
85-
86-
::IO.setup(socket, fd, nil, true)
87-
socket.binmode
84+
socket = new_class.for_fd(fd)
8885

8986
socktype = source.getsockopt(:SOCKET, :TYPE).int
9087
addrinfo = Addrinfo.new(sockaddr.to_s, sockaddr.family, socktype)

0 commit comments

Comments
 (0)