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

Method peek

lib_acl_cpp/src/hsocket/hspool.cpp:42–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42hsclient* hspool::peek(const char* dbn, const char* tbl,
43 const char* idx, const char* flds, bool readonly /* = false */)
44{
45 hsclient* client;
46 const char* addr;
47
48 if (readonly) {
49 addr = addr_rd_;
50 } else {
51 addr = addr_rw_;
52 }
53
54 locker_->lock();
55
56 // ��˳���ѯ���ϱ��ֶ����������Ӷ���
57 std::list<hsclient*>::iterator it = pool_.begin();
58 for (; it != pool_.end(); ++it) {
59 // �����ַ��ƥ�����������ַ����ƥ��
60 if (strcmp((*it)->get_addr(), addr) != 0) {
61 continue;
62 }
63
64 // ���Ѿ��򿪵ı�����ѯ���ֶ��Ƿ����
65 if ((*it)->open_tbl(dbn, tbl, idx, flds, false)) {
66 client = *it;
67 pool_.erase(it);
68 locker_->unlock();
69 return client;
70 }
71 }
72
73 // ��ѯ��ַƥ������Ӷ����������һ��ƥ������Ӷ�����
74 // ���µı�
75 for (it = pool_.begin(); it != pool_.end();) {
76 // �����ַ��ƥ�����������ַ����ƥ��
77 if (strcmp((*it)->get_addr(), addr) != 0) {
78 ++it;
79 continue;
80 }
81
82 client = *it;
83 it = pool_.erase(it); // �����ӳ���ɾ��
84
85 // ���µı�
86 if (client->open_tbl(dbn, tbl, idx, flds, true)) {
87 locker_->unlock();
88 return client;
89 }
90
91 // ��ʧ�ܣ�����Ҫɾ�������Ӷ���
92 delete client;
93 }
94
95 locker_->unlock();
96
97 client = NEW hsclient(addr, cache_enable_, retry_enable_);
98
99 if (!client->open_tbl(dbn, tbl, idx, flds)) {

Callers 15

thread_mainFunction · 0.45
thread_mainFunction · 0.45
thread_mainFunction · 0.45
hspool_findFunction · 0.45
hspool_updateFunction · 0.45
runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
runMethod · 0.45
thread_mainFunction · 0.45
mainFunction · 0.45

Calls 7

beginMethod · 0.80
open_tblMethod · 0.80
hsclientClass · 0.50
lockMethod · 0.45
endMethod · 0.45
get_addrMethod · 0.45
unlockMethod · 0.45

Tested by

no test coverage detected