lib/whois/server/socket_handler.rb in whois-6.0.0 vs lib/whois/server/socket_handler.rb in whois-6.0.1

- old
+ new

@@ -7,12 +7,12 @@ # # Copyright (c) 2009-2024 Simone Carletti <weppos@weppos.net> #++ -require 'socket' -require 'whois/errors' +require "socket" +require "whois/errors" module Whois class Server @@ -56,10 +56,10 @@ def execute(query, *args) client = TCPSocket.new(*args) client.write("#{query}\r\n") # I could use put(foo) and forget the \n client.read # but write/read is more symmetric than puts/read ensure # and I really want to use read instead of gets. - client.close if client # If != client something went wrong. + client&.close # If != client something went wrong. end end end end