<commit_before># encoding: utf-8

require 'logger'
require 'mosquitto/logging'

class Mosquitto::Client
  include Mosquitto::Logging

  if RUBY_VERSION.split(".").first == '2'
    def wait_readable(timeout = 15)
      IO.for_fd(socket).wait_readable(timeout)
    end
  else
    def wait_readable(timeout = 15)
      IO.for_fd(socket).wait(timeout)
    end
  end
end<commit_msg>Let Client#wait_readable respect new socket connect || disconnect semantics of 1.3.1<commit_after># encoding: utf-8

require 'logger'
require 'mosquitto/logging'

class Mosquitto::Client
  include Mosquitto::Logging

  if RUBY_VERSION.split(".").first == '2'
    def wait_readable(timeout = 15)
      retries ||= 0
      IO.for_fd(socket).wait_readable(timeout)
    rescue Errno::EBADF
      retries += 1
      sleep 0.5
      raise if retries > 4
    end
  else
    def wait_readable(timeout = 15)
      retries ||= 0
      IO.for_fd(socket).wait(timeout)
    rescue Errno::EBADF
      retries += 1
      sleep 0.5
      raise if retries > 4
    end
  end
end
{'fraction_non_alphanumeric': 0.10703953712632594, 'fraction_numerical': 0.024108003857280617, 'mean_word_length': 3.070588235294118, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6779209', 'n_tokens_mistral': 386, 'n_tokens_neox': 348, 'n_words': 86}