lib/nonnative/socket_pair.rb in nonnative-1.23.0 vs lib/nonnative/socket_pair.rb in nonnative-1.24.0

- old
+ new

@@ -1,11 +1,11 @@ # frozen_string_literal: true module Nonnative class SocketPair - def initialize(port) - @port = port + def initialize(proxy) + @proxy = proxy end def connect(local_socket) remote_socket = create_remote_socket @@ -20,13 +20,13 @@ remote_socket&.close end protected - attr_reader :port + attr_reader :proxy def create_remote_socket - ::TCPSocket.new('0.0.0.0', port) + ::TCPSocket.new('0.0.0.0', proxy.port) end def pipe(ready, socket1, socket2) if ready[0].include?(socket1) data = read(socket1)