Commit c770d6fc4a7c72b0a6f20011c37f36bdd6ee3a02
- Diff rendering mode:
- inline
- side by side
src/fbsession.cpp
(8 / 5)
|   | |||
| 53 | 53 | iApiKey (aAppKey), | |
| 54 | 54 | iApiSecret ( aAppSecret ), | |
| 55 | 55 | iGetSessionProxy ( aGetSessionProxy ), | |
| 56 | iUid(0), | ||
| 57 | iRequestBurstCount(0), | ||
| 56 | 58 | iSettings ("malang", "qfbconnect") | |
| 57 | 59 | { | |
| 58 | 60 | if (!sharedSession) | |
| … | … | ||
| 204 | 204 | ||
| 205 | 205 | void FBSession::startFlushTimer() | |
| 206 | 206 | { | |
| 207 | int t = kBurstDuration + iLastRequestTime.secsTo( QDateTime::currentDateTime()); | ||
| 207 | int t = kBurstDuration; | ||
| 208 | 208 | QTimer::singleShot( t, this, SLOT(requestTimerReady())); | |
| 209 | 209 | } | |
| 210 | 210 | ||
| … | … | ||
| 219 | 219 | // them for making too many requests in a short time | |
| 220 | 220 | ||
| 221 | 221 | int seconds = iLastRequestTime.secsTo( QDateTime::currentDateTime() ); | |
| 222 | bool burst = seconds && seconds > -kBurstDuration; | ||
| 222 | bool burst = seconds && (seconds < kBurstDuration); | ||
| 223 | 223 | ||
| 224 | if (burst && iRequestBurstCount > kMaxBurstRequests) | ||
| 224 | if (burst && (iRequestBurstCount > kMaxBurstRequests)) | ||
| 225 | 225 | { | |
| 226 | 226 | if (aEnqueue) | |
| 227 | 227 | { | |
| … | … | ||
| 232 | 232 | else | |
| 233 | 233 | { | |
| 234 | 234 | aRequest->connect(); | |
| 235 | if (!burst) | ||
| 236 | { | ||
| 235 | if (burst) { | ||
| 236 | iRequestBurstCount++; | ||
| 237 | } else { | ||
| 237 | 238 | iRequestBurstCount = 1; | |
| 238 | 239 | iLastRequestTime = aRequest->timeStamp(); | |
| 239 | 240 | } |

