lib/socketry/timeout.rb
def set_timeout(timeout)
      raise Socketry::InternalError, "deadline already set" if @deadline
      return unless timeout
      raise Socketry::TimeoutError, "time expired" if timeout < 0

      @deadline = lifetime + timeout
    end
def set_timeout(timeout)
      raise Socketry::InternalError, "deadline already set" if @deadline
      return unless timeout
      raise Socketry::TimeoutError, "time expired" if timeout < 0

      @deadline = lifetime + timeout
    end
Set a timeout. Only one timeout may be active at a given time for a given object.

 @param timeout [Numeric] number of seconds until the timeout is reached
 @return [Float] deadline (relative to #lifetime) at which the timeout is reached
 @raise [Socketry::InternalError] if timeout is already set