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

Method checkBoundConnection

src/jrd/extds/ExtDS.cpp:1276–1346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1274}
1275
1276bool ConnectionsPool::checkBoundConnection(thread_db* tdbb, Connection* conn)
1277{
1278 if (conn->isCurrent())
1279 return true;
1280
1281 ConnectionsPool::Data* item = conn->getPoolData();
1282 string s;
1283
1284 if (!item->getConnPool())
1285 {
1286 s.printf("Bound connection 0x%08X is not at the pool.\n", conn);
1287 s.append(item->print());
1288 gds__log(s.c_str());
1289 return false;
1290 }
1291
1292 ConnectionsPool* pool = item->m_connPool;
1293 MutexLockGuard guard(pool->m_mutex, FB_FUNCTION);
1294
1295 if (!item->m_next || !item->m_prev)
1296 {
1297 s.printf("Bound connection 0x%08X is not at the pool list.\n", conn);
1298 s.append(item->print());
1299 pool->printPool(s);
1300 gds__log(s.c_str());
1301 return false;
1302 }
1303
1304 ConnectionsPool::Data* list = NULL;
1305 if (item->m_lastUsed)
1306 {
1307 if (!pool->m_idleArray.exist(*item))
1308 {
1309 s.printf("Bound connection 0x%08X is not found in idleArray.\n", conn);
1310 s.append(item->print());
1311 pool->printPool(s);
1312 gds__log(s.c_str());
1313 return false;
1314 }
1315 list = pool->m_idleList;
1316 }
1317 else
1318 list = pool->m_activeList;
1319
1320 if (!list)
1321 {
1322 s.printf("Bound connection 0x%08X belongs to the empty list.\n", conn);
1323 s.append(item->print());
1324 pool->printPool(s);
1325 gds__log(s.c_str());
1326 return false;
1327 }
1328
1329 ConnectionsPool::Data* p = list;
1330 do
1331 {
1332 if (p == item)
1333 break;

Callers

nothing calls this directly

Calls 9

getPoolDataMethod · 0.80
printPoolMethod · 0.80
isCurrentMethod · 0.45
getConnPoolMethod · 0.45
printfMethod · 0.45
appendMethod · 0.45
printMethod · 0.45
c_strMethod · 0.45
existMethod · 0.45

Tested by

no test coverage detected