MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / releaseConnection

Method releaseConnection

src/jrd/extds/ExtDS.cpp:464–541  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

462}
463
464void Provider::releaseConnection(thread_db* tdbb, Connection& conn, bool inPool)
465{
466 ConnectionsPool* connPool = conn.getConnPool();
467 Attachment* att = conn.getBoundAtt();
468
469 { // m_mutex scope
470 MutexLockGuard guard(m_mutex, FB_FUNCTION);
471
472 bool found = false;
473 AttToConnMap::Accessor acc(&m_connections);
474 if (acc.locate(AttToConn(att, &conn)))
475 {
476 Connection* test = acc.current().m_conn;
477 fb_assert(test == &conn);
478
479 found = true;
480 acc.fastRemove();
481 };
482
483 fb_assert(found);
484 conn.setBoundAtt(NULL);
485
486 if (inPool && connPool)
487 m_connections.add(AttToConn(NULL, &conn));
488 }
489
490 FbLocalStatus resetError;
491 inPool = inPool && connPool && connPool->getMaxCount() &&
492 conn.isConnected() && conn.hasValidCryptCallback();
493
494 if (inPool)
495 {
496 inPool = conn.resetSession(tdbb);
497
498 // Check if reset of external session failed when parent (local) attachment
499 // is resetting or run ON DISCONNECT trigger.
500
501 const auto status = tdbb->tdbb_status_vector;
502 if (!inPool && status->hasData())
503 {
504 if (att->att_flags & ATT_resetting)
505 resetError.loadFrom(status);
506 else
507 {
508 auto req = tdbb->getRequest();
509 while (req)
510 {
511 if (req->req_trigger_action == TRIGGER_DISCONNECT)
512 {
513 resetError.loadFrom(status);
514 break;
515 }
516 req = req->req_caller;
517 }
518 }
519 }
520 }
521

Callers 7

deleteTransactionMethod · 0.80
releaseStatementMethod · 0.80
putConnectionMethod · 0.80
addConnectionMethod · 0.80
delConnectionMethod · 0.80
clearIdleMethod · 0.80
clearMethod · 0.80

Calls 15

AttToConnClass · 0.85
getBoundAttMethod · 0.80
setBoundAttMethod · 0.80
getMaxCountMethod · 0.80
hasValidCryptCallbackMethod · 0.80
loadFromMethod · 0.80
putConnectionMethod · 0.80
delConnectionMethod · 0.80
getConnPoolMethod · 0.45
locateMethod · 0.45
currentMethod · 0.45
fastRemoveMethod · 0.45

Tested by

no test coverage detected