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

Method add_timeout_callback

lib_acl_cpp/src/stream/aio_stream.cpp:208–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208void aio_stream::add_timeout_callback(aio_callback* callback)
209{
210 acl_assert(callback);
211
212 if (timeout_callbacks_ == NULL) {
213 timeout_callbacks_ = NEW std::list<AIO_CALLBACK*>;
214 }
215
216 // �Ȳ�ѯ�ûص������Ѿ�����
217 std::list<AIO_CALLBACK*>::iterator it = timeout_callbacks_->begin();
218 for (; it != timeout_callbacks_->end(); ++it) {
219 if ((*it)->callback == callback) {
220 if ((*it)->enable == false) {
221 (*it)->enable = true;
222 }
223 return;
224 }
225 }
226
227 // ��һ����λ
228 it = timeout_callbacks_->begin();
229 for (; it != timeout_callbacks_->end(); ++it) {
230 if ((*it)->callback == NULL) {
231 (*it)->enable = true;
232 (*it)->callback = callback;
233 return;
234 }
235 }
236
237 // ����һ���µ�λ��
238 AIO_CALLBACK* ac = (AIO_CALLBACK*) acl_mycalloc(1, sizeof(AIO_CALLBACK));
239 ac->enable = true;
240 ac->callback = callback;
241
242 // ���ӽ��ص����������
243 timeout_callbacks_->push_back(ac);
244}
245
246int aio_stream::del_close_callback(aio_callback* callback)
247{

Callers 15

handle_clientMethod · 0.80
accept_callbackMethod · 0.80
connect_serverMethod · 0.80
accept_callbackMethod · 0.80
connect_serverFunction · 0.80
accept_callbackMethod · 0.80
accept_callbackMethod · 0.80
connect_serverFunction · 0.80
handle_clientMethod · 0.80
accept_callbackMethod · 0.80
handle_clientMethod · 0.80
connect_serverFunction · 0.80

Calls 3

beginMethod · 0.80
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected