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

Method wait

lib_acl_cpp/src/ipc/ipc_client.cpp:109–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109void ipc_client::wait(void)
110{
111 if (closing_) {
112 return;
113 }
114
115 // ͬ��������Ϣ
116 if (sync_stream_) {
117 MSG_HDR hdr;
118 int n;
119 n = sync_stream_->read(&hdr, sizeof(hdr));
120 if (n < 0) {
121 close();
122 return;
123 }
124 if ((n = hdr.dlen) <= 0) {
125 trigger(hdr.nMsg, NULL, 0);
126 return;
127 }
128 string buf(n);
129
130 if (sync_stream_->read(buf.c_str(), n) < 0) {
131 close();
132 return;
133 }
134 trigger(hdr.nMsg, buf.c_str(), n);
135 }
136
137 // �첽������Ϣ
138 else if (async_stream_) {
139 // �����첽����Ϣ����
140 status_ = IO_WAIT_HDR;
141 async_stream_->read(sizeof(MSG_HDR));
142 }
143
144 // δ֪���
145 else {
146 acl_assert(0);
147 }
148}
149
150void ipc_client::close(void)
151{

Callers 1

on_acceptMethod · 0.45

Calls 3

closeFunction · 0.50
readMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected