MCPcopy Create free account
hub / github.com/ceph/ceph / entry

Method entry

src/msg/DispatchQueue.cc:158–216  ·  view source on GitHub ↗

* This function delivers incoming messages to the Messenger. * Connections with messages are kept in queues; when beginning a message * delivery the highest-priority queue is selected, the connection from the * front of the queue is removed, and its message read. If the connection * has remaining messages at that priority level, it is re-placed on to the * end of the queue. If the queue is em

Source from the content-addressed store, hash-verified

156 * The message is then delivered and the process starts again.
157 */
158void DispatchQueue::entry()
159{
160 std::unique_lock l{lock};
161 while (true) {
162 while (!mqueue.empty()) {
163 QueueItem qitem = mqueue.dequeue();
164 if (!qitem.is_code())
165 remove_arrival(qitem);
166 l.unlock();
167
168 if (qitem.is_code()) {
169 if (cct->_conf->ms_inject_internal_delays &&
170 cct->_conf->ms_inject_delay_probability &&
171 (rand() % 10000)/10000.0 < cct->_conf->ms_inject_delay_probability) {
172 utime_t t;
173 t.set_from_double(cct->_conf->ms_inject_internal_delays);
174 ldout(cct, 1) << "DispatchQueue::entry inject delay of " << t
175 << dendl;
176 t.sleep();
177 }
178 switch (qitem.get_code()) {
179 case D_BAD_REMOTE_RESET:
180 msgr->ms_deliver_handle_remote_reset(qitem.get_connection());
181 break;
182 case D_CONNECT:
183 msgr->ms_deliver_handle_connect(qitem.get_connection());
184 break;
185 case D_ACCEPT:
186 msgr->ms_deliver_handle_accept(qitem.get_connection());
187 break;
188 case D_BAD_RESET:
189 msgr->ms_deliver_handle_reset(qitem.get_connection());
190 break;
191 case D_CONN_REFUSED:
192 msgr->ms_deliver_handle_refused(qitem.get_connection());
193 break;
194 default:
195 ceph_abort();
196 }
197 } else {
198 const ref_t<Message>& m = qitem.get_message();
199 if (stop) {
200 ldout(cct,10) << " stop flag set, discarding " << m << " " << *m << dendl;
201 } else {
202 uint64_t msize = pre_dispatch(m);
203 msgr->ms_deliver_dispatch(m);
204 post_dispatch(m, msize);
205 }
206 }
207
208 l.lock();
209 }
210 if (stop)
211 break;
212
213 // wait for something to be put on queue
214 cond.wait(l);
215 }

Callers

nothing calls this directly

Calls 15

is_codeMethod · 0.80
set_from_doubleMethod · 0.80
get_codeMethod · 0.80
get_messageMethod · 0.80
ms_deliver_dispatchMethod · 0.80
emptyMethod · 0.45
dequeueMethod · 0.45

Tested by

no test coverage detected