server.rb
def safelyRun(client)
    begin
      yield(client)
    rescue Errno::ECONNRESET, EOFError, Errno::EPIPE
      client.close
      @clients.delete(client)
      puts "Deleted client, total connections #{@clients.size}"
    end
  end
# Execute a command against a client and handle any errors the client
# may throw. If we receive an error from the client it is most likely
# due to the client disconnecting. Clients automatically reconnect
# after 20 seconds anyway, so it doesn't hurt to clean up and remove
# the client if it is having issues.
Execute a command against a client and handle any errors the client
may throw. If we receive an error from the client it is most likely
due to the client disconnecting. Clients automatically reconnect
after 20 seconds anyway, so it doesn't hurt to clean up and remove
the client if it is having issues.
Execute a command against a client and handle any errors the client may throw . If we receive an error from the client it is most likely due to the client disconnecting . Clients automatically reconnect after 20 seconds anyway so it doesn ' t hurt to clean up and remove the client if it is having issues .
def safelyRun(client)
    begin
      yield(client)
    rescue Errno::ECONNRESET, EOFError, Errno::EPIPE
      client.close
      @clients.delete(client)
      puts "Deleted client, total connections #{@clients.size}"
    end
  end
def safelyRun ( client ) begin yield ( client ) rescue Errno :: ECONNRESET , EOFError , Errno :: EPIPE client . close @clients . delete ( client ) puts "Deleted client, total connections #{@clients.size}" end end
Execute a command against a client and handle any errors the client
may throw.
Execute a command against a client and handle any errors the client may throw .
client