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

Method availableSession

src/async/imap/MCIMAPAsyncSession.cpp:319–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

317}
318
319IMAPAsyncConnection * IMAPAsyncSession::availableSession()
320{
321 // try find existant session with empty queue for reusing.
322 IMAPAsyncConnection * chosenSession = sessionWithMinQueue(false, NULL);
323 if ((chosenSession != NULL) && (chosenSession->operationsCount() == 0)) {
324 return chosenSession;
325 }
326
327 // create new session, if maximum connections limit does not reached yet.
328 if ((mMaximumConnections == 0) || (mSessions->count() < mMaximumConnections)) {
329 chosenSession = session();
330 mSessions->addObject(chosenSession);
331 return chosenSession;
332 }
333
334 // otherwise returns existant session with minimum size of queue.
335 return chosenSession;
336}
337
338IMAPAsyncConnection * IMAPAsyncSession::matchingSessionForFolder(String * folder)
339{

Callers

nothing calls this directly

Calls 3

operationsCountMethod · 0.80
countMethod · 0.45
addObjectMethod · 0.45

Tested by

no test coverage detected