lib/zmachine/tcp_channel.rb in zmachine-0.3.0 vs lib/zmachine/tcp_channel.rb in zmachine-0.3.2
- old
+ new
@@ -19,20 +19,20 @@
@socket.configure_blocking(false)
@socket.bind(address)
end
def bound?
- @socket.is_a?(ServerSocketChannel) && @socket.bound?
+ @socket.is_a?(ServerSocketChannel) && @socket.socket.bound?
end
def accept
ZMachine.logger.debug("zmachine:tcp_channel:#{__method__}", channel: self) if ZMachine.debug
client_socket = @socket.accept
return unless client_socket
client_socket.configure_blocking(false)
- TCPChannel.new.tap do |channel|
- channel.socket = client_socket
- end
+ channel = TCPChannel.new
+ channel.socket = client_socket
+ channel
end
def connect(address, port)
ZMachine.logger.debug("zmachine:tcp_channel:#{__method__}", channel: self) if ZMachine.debug
address = InetSocketAddress.new(address, port)