| 296 | } |
| 297 | |
| 298 | void IMAPAsyncConnection::tryAutomaticDisconnect() |
| 299 | { |
| 300 | // It's safe since no thread is running when this function is called. |
| 301 | if (mSession->isDisconnected()) { |
| 302 | return; |
| 303 | } |
| 304 | |
| 305 | bool scheduledAutomaticDisconnect = mScheduledAutomaticDisconnect; |
| 306 | if (scheduledAutomaticDisconnect) { |
| 307 | #if __APPLE__ |
| 308 | cancelDelayedPerformMethodOnDispatchQueue((Object::Method) &IMAPAsyncConnection::tryAutomaticDisconnectAfterDelay, NULL, dispatchQueue()); |
| 309 | #else |
| 310 | cancelDelayedPerformMethod((Object::Method) &IMAPAsyncConnection::tryAutomaticDisconnectAfterDelay, NULL); |
| 311 | #endif |
| 312 | } |
| 313 | |
| 314 | mOwner->retain(); |
| 315 | mScheduledAutomaticDisconnect = true; |
| 316 | #if __APPLE__ |
| 317 | performMethodOnDispatchQueueAfterDelay((Object::Method) &IMAPAsyncConnection::tryAutomaticDisconnectAfterDelay, NULL, dispatchQueue(), 30); |
| 318 | #else |
| 319 | performMethodAfterDelay((Object::Method) &IMAPAsyncConnection::tryAutomaticDisconnectAfterDelay, NULL, 30); |
| 320 | #endif |
| 321 | |
| 322 | if (scheduledAutomaticDisconnect) { |
| 323 | mOwner->release(); |
| 324 | } |
| 325 | } |
| 326 | |
| 327 | void IMAPAsyncConnection::tryAutomaticDisconnectAfterDelay(void * context) |
| 328 | { |
no test coverage detected