| 518 | } |
| 519 | |
| 520 | inline void Release(TConnectionRef conn) { |
| 521 | if (!ExceedHardLimit()) { |
| 522 | size_t maxConnId = MaxConnId_.load(std::memory_order_acquire); |
| 523 | |
| 524 | while (maxConnId < (*conn)->Host.Id) { |
| 525 | MaxConnId_.compare_exchange_strong( |
| 526 | maxConnId, |
| 527 | (*conn)->Host.Id, |
| 528 | std::memory_order_seq_cst, |
| 529 | std::memory_order_seq_cst); |
| 530 | maxConnId = MaxConnId_.load(std::memory_order_acquire); |
| 531 | } |
| 532 | ConnList((*conn)->Host).Enqueue(conn); |
| 533 | CachedConnections.Inc(); |
| 534 | ActiveConnections.Dec(); |
| 535 | } |
| 536 | |
| 537 | if (CachedConnections.Val() && ExceedSoftLimit()) { |
| 538 | SuggestPurgeCache(); |
| 539 | } |
| 540 | } |
| 541 | |
| 542 | void SetFdLimits(size_t soft, size_t hard) { |
| 543 | Limits.SetSoft(soft); |
no test coverage detected