| 518 | } |
| 519 | |
| 520 | HSMresult_t |
| 521 | HttpSessionManager::release_session(PoolableSession *to_release) |
| 522 | { |
| 523 | EThread *ethread = this_ethread(); |
| 524 | ServerSessionPool *pool = |
| 525 | TS_SERVER_SESSION_SHARING_POOL_THREAD == to_release->sharing_pool ? ethread->server_session_pool : m_g_pool; |
| 526 | bool released_p = true; |
| 527 | |
| 528 | // The per thread lock looks like it should not be needed but if it's not locked the close checking I/O op will crash. |
| 529 | |
| 530 | { |
| 531 | MutexLock mlock; |
| 532 | MutexTryLock tlock; |
| 533 | bool const locked = lockSessionPool(pool->mutex, ethread, this->get_pool_type(), &mlock, &tlock); |
| 534 | |
| 535 | if (locked) { |
| 536 | pool->releaseSession(to_release); |
| 537 | } else if (this->get_pool_type() == TS_SERVER_SESSION_SHARING_POOL_HYBRID) { |
| 538 | // Try again with the thread pool |
| 539 | to_release->sharing_pool = TS_SERVER_SESSION_SHARING_POOL_THREAD; |
| 540 | return release_session(to_release); |
| 541 | } else { |
| 542 | Dbg(dbg_ctl_http_ss, "[%" PRId64 "] [release session] could not release session due to lock contention", |
| 543 | to_release->connection_id()); |
| 544 | released_p = false; |
| 545 | } |
| 546 | } |
| 547 | |
| 548 | return released_p ? HSM_DONE : HSM_RETRY; |
| 549 | } |
| 550 | |
| 551 | void |
| 552 | ServerSessionPool::removeSession(PoolableSession *to_remove) |
no test coverage detected