diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-17 23:29:10 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-17 23:29:10 +0000 |
commit | f2bbe49b6d6ae46b3981974333f9f60594c3e768 (patch) | |
tree | 8b40006476777285a5d8db873062ce9a9a225215 /src/util | |
parent | a4132872aeb6b52a2493478686f236975fe069b4 (diff) | |
download | gnunet-f2bbe49b6d6ae46b3981974333f9f60594c3e768.tar.gz gnunet-f2bbe49b6d6ae46b3981974333f9f60594c3e768.zip |
exit loop once first handler is found
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/mq.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/util/mq.c b/src/util/mq.c index 254e5d33e..0d8b67d49 100644 --- a/src/util/mq.c +++ b/src/util/mq.c | |||
@@ -207,23 +207,22 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq, | |||
207 | const struct GNUNET_MQ_MessageHandler *handler; | 207 | const struct GNUNET_MQ_MessageHandler *handler; |
208 | int handled = GNUNET_NO; | 208 | int handled = GNUNET_NO; |
209 | 209 | ||
210 | handler = mq->handlers; | 210 | if (NULL == mq->handlers) |
211 | if (NULL == handler) | ||
212 | { | 211 | { |
213 | LOG (GNUNET_ERROR_TYPE_WARNING, | 212 | LOG (GNUNET_ERROR_TYPE_WARNING, |
214 | "No handler for message of type %d\n", | 213 | "No handler for message of type %d\n", |
215 | ntohs (mh->type)); | 214 | ntohs (mh->type)); |
216 | return; | 215 | return; |
217 | } | 216 | } |
218 | for (; NULL != handler->cb; handler++) | 217 | for (handler = mq->handlers; NULL != handler->cb; handler++) |
219 | { | 218 | { |
220 | if (handler->type == ntohs (mh->type)) | 219 | if (handler->type == ntohs (mh->type)) |
221 | { | 220 | { |
222 | handler->cb (mq->handlers_cls, mh); | 221 | handler->cb (mq->handlers_cls, mh); |
223 | handled = GNUNET_YES; | 222 | handled = GNUNET_YES; |
223 | break; | ||
224 | } | 224 | } |
225 | } | 225 | } |
226 | |||
227 | if (GNUNET_NO == handled) | 226 | if (GNUNET_NO == handled) |
228 | LOG (GNUNET_ERROR_TYPE_WARNING, | 227 | LOG (GNUNET_ERROR_TYPE_WARNING, |
229 | "No handler for message of type %d\n", | 228 | "No handler for message of type %d\n", |