MCPcopy Create free account
hub / github.com/MailCore/mailcore2 / tryAutomaticDisconnect

Method tryAutomaticDisconnect

src/async/imap/MCIMAPAsyncConnection.cpp:298–325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298void 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
327void IMAPAsyncConnection::tryAutomaticDisconnectAfterDelay(void * context)
328{

Callers 1

queueStoppedRunningMethod · 0.45

Calls 3

retainMethod · 0.80
releaseMethod · 0.80
isDisconnectedMethod · 0.45

Tested by

no test coverage detected