queryspeed.cpp
1 //------------------------------------------------------------------------------
2 // queryspeed.cpp
3 //------------------------------------------------------------------------------
4 //
5 // This library is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation; either
8 // version 2.1 of the License, or (at your option) any later version.
9 //
10 // This library is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with this library; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
18 // 02110-1301 USA
19 //
20 //------------------------------------------------------------------------------
21 // Copyright (C) 2015 "Zalewa" <zalewapl@gmail.com>
22 //------------------------------------------------------------------------------
23 #include "queryspeed.h"
24 
25 const QuerySpeed QuerySpeed::MAX_SPEED = {1, 1000, 1};
26 const int QuerySpeed::MAX_ATTEMPTS_PER_SERVER = 10;
27 
28 QuerySpeed QuerySpeed::cautious()
29 {
30  QuerySpeed result;
31  result.attemptsPerServer = 3;
32  result.delayBetweenSingleServerAttempts = 3500;
33  result.intervalBetweenServers = 60;
34  return result;
35 }
36 
37 QuerySpeed QuerySpeed::moderate()
38 {
39  QuerySpeed result;
40  result.attemptsPerServer = 3;
41  result.delayBetweenSingleServerAttempts = 3000;
42  result.intervalBetweenServers = 30;
43  return result;
44 }
45 
46 QuerySpeed QuerySpeed::aggressive()
47 {
48  QuerySpeed result;
49  result.attemptsPerServer = 2;
50  result.delayBetweenSingleServerAttempts = 2000;
51  result.intervalBetweenServers = 5;
52  return result;
53 }
54 
55 QuerySpeed QuerySpeed::veryAggressive()
56 {
57  return MAX_SPEED;
58 }