module Mysql2::EM::Client::Watcher

def initialize(client, deferable)

def initialize(client, deferable)
  @client = client
  @deferable = deferable
  @is_watching = true
end

def notify_readable

def notify_readable
  detach
  begin
    result = @client.async_result
  rescue StandardError => e
    @deferable.fail(e)
  else
    @deferable.succeed(result)
  end
end

def unbind

def unbind
  @is_watching = false
end

def watching?

def watching?
  @is_watching
end