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

Method add_open_callback

lib_acl_cpp/src/stream/aio_socket_stream.cpp:78–113  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78void aio_socket_stream::add_open_callback(aio_open_callback* callback)
79{
80 if (open_callbacks_ == NULL) {
81 open_callbacks_ = NEW std::list<AIO_OPEN_CALLBACK*>;
82 }
83
84 // �Ȳ�ѯ�ûص������Ѿ�����
85 std::list<AIO_OPEN_CALLBACK*>::iterator it = open_callbacks_->begin();
86 for (; it != open_callbacks_->end(); ++it) {
87 if ((*it)->callback == callback) {
88 if ((*it)->enable == false) {
89 (*it)->enable = true;
90 }
91 return;
92 }
93 }
94
95 // ��һ����λ
96 it = open_callbacks_->begin();
97 for (; it != open_callbacks_->end(); ++it) {
98 if ((*it)->callback == NULL) {
99 (*it)->enable = true;
100 (*it)->callback = callback;
101 return;
102 }
103 }
104
105 // ����һ���µ�λ��
106 AIO_OPEN_CALLBACK* ac = (AIO_OPEN_CALLBACK*)
107 acl_mycalloc(1, sizeof(AIO_OPEN_CALLBACK));
108 ac->enable = true;
109 ac->callback = callback;
110
111 // ���ӽ��ص����������
112 open_callbacks_->push_back(ac);
113}
114
115int aio_socket_stream::del_open_callback(aio_open_callback* callback /* = NULL */)
116{

Callers 10

connect_serverMethod · 0.80
connect_serverFunction · 0.80
connect_serverFunction · 0.80
connect_serverFunction · 0.80
openMethod · 0.80
connect_ssl_serverFunction · 0.80
connect_serverFunction · 0.80
startMethod · 0.80
timer_callbackMethod · 0.80
openMethod · 0.80

Calls 3

beginMethod · 0.80
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected