| 392 | } |
| 393 | |
| 394 | Connection* Provider::getBoundConnection(Jrd::thread_db* tdbb, |
| 395 | const Firebird::PathName& dbName, Firebird::ClumpletReader& dpb, |
| 396 | TraScope tra_scope, bool isCurrentAtt) |
| 397 | { |
| 398 | Database* dbb = tdbb->getDatabase(); |
| 399 | Attachment* att = tdbb->getAttachment(); |
| 400 | CryptHash ch; |
| 401 | if (!isCurrentAtt) |
| 402 | ch.assign(att->att_crypt_callback); |
| 403 | |
| 404 | MutexLockGuard guard(m_mutex, FB_FUNCTION); |
| 405 | |
| 406 | AttToConnMap::Accessor acc(&m_connections); |
| 407 | if (acc.locate(locGreatEqual, AttToConn(att, NULL))) |
| 408 | { |
| 409 | do |
| 410 | { |
| 411 | Connection* conn = acc.current().m_conn; |
| 412 | |
| 413 | if (conn->getBoundAtt() != att) |
| 414 | break; |
| 415 | |
| 416 | if (conn->isSameDatabase(dbName, dpb, ch) && |
| 417 | conn->isAvailable(tdbb, tra_scope)) |
| 418 | { |
| 419 | fb_assert(conn->getProvider() == this); |
| 420 | |
| 421 | #ifdef EDS_DEBUG |
| 422 | if (!ConnectionsPool::checkBoundConnection(tdbb, conn)) |
| 423 | continue; |
| 424 | #endif |
| 425 | |
| 426 | if (!isCurrentAtt) |
| 427 | conn->resetRedirect(att->att_crypt_callback); |
| 428 | return conn; |
| 429 | } |
| 430 | } while (acc.getNext()); |
| 431 | } |
| 432 | |
| 433 | return NULL; |
| 434 | } |
| 435 | |
| 436 | void Provider::jrdAttachmentEnd(thread_db* tdbb, Jrd::Attachment* att, bool forced) |
| 437 | { |
no test coverage detected