~pete-woods/unity-scopes-api/add-system-session-files

« back to all changes in this revision

Viewing changes to src/scopes/internal/ScopeConfig.cpp

  • Committer: Tarmac
  • Author(s): Marcus Tomlinson
  • Date: 2016-10-13 14:32:05 UTC
  • mfrom: (689.1.2 devel)
  • Revision ID: tarmac-20161013143205-3ph3bciwc6on46b9
Be much stricter on idle timeout (1s to 5min).

Approved by unity-api-1-bot, Marcus Tomlinson.

Show diffs side-by-side

added added

removed removed

Lines of Context:
173
173
 
174
174
    idle_timeout_ = get_optional_int(scope_config_group, idle_timeout_key, DFLT_SCOPE_IDLE_TIMEOUT);
175
175
 
176
 
    // Negative values and values greater than max int (once multiplied by 1000 (s to ms)) are illegal
177
 
    const int max_idle_timeout = std::numeric_limits<int>::max() / 1000;
178
 
    if ((idle_timeout_ < 0 || idle_timeout_ > max_idle_timeout) && idle_timeout_ != -1)
 
176
    // Values less than 1s and greater than 300s are illegal
 
177
    if (idle_timeout_ < 1 || idle_timeout_ > 300)
179
178
    {
180
179
        throw_ex("Illegal value (" + std::to_string(idle_timeout_) + ") for " + idle_timeout_key +
181
 
                 ": value must be >= 0 and <= " + std::to_string(max_idle_timeout));
 
180
                 ": value must be >= 1 and <= 300");
182
181
    }
183
182
 
184
183
    results_ttl_type_ = ScopeMetadata::ResultsTtlType::None;