MCPcopy Create free account
hub / github.com/acl-dev/acl / put

Method put

lib_acl_cpp/independent/connpool/src/connect_pool.cpp:99–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97}
98
99void connect_pool::put(connect_client* conn, bool keep /* = true */)
100{
101 time_t now = time(NULL);
102
103 lock_->lock();
104
105 // ����Ƿ������������ٱ�־λ
106 if (delay_destroy_)
107 {
108 delete conn;
109 count_--;
110 assert(count_ >= 0);
111 if (count_ == 0)
112 {
113 // ������ü���Ϊ 0 ��������
114 lock_->unlock();
115 delete this;
116 }
117 return;
118 }
119
120 if (keep && alive_)
121 {
122 conn->set_when(now);
123 pool_.push_front(conn);
124 }
125 else
126 {
127 delete conn;
128 count_--;
129 assert(count_ >= 0);
130 }
131
132 if (idle_ttl_ >= 0 && now - last_check_ >= check_inter_)
133 {
134 (void) check_idle(idle_ttl_, false);
135 (void) time(&last_check_);
136 }
137 lock_->unlock();
138}
139
140void connect_pool::set_delay_destroy()
141{

Callers 2

~connect_guardFunction · 0.45
~connect_guardFunction · 0.45

Calls 4

set_whenMethod · 0.80
push_frontMethod · 0.80
lockMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected