}
}
- /* Now test that the duplicate filtering code works. */
+ /* Ensure all messages get through to ourselves. */
pong_count = 0;
strlcpy(buf, "1234567890", sizeof(buf));
MSG_PING,(uint8 *)buf, 11);
}
- for (i=0;i<n;i++) {
+ /*
+ * We have to loop at least 2 times for
+ * each message as local ping messages are
+ * handled by an immediate callback, that
+ * has to be dispatched, which sends a pong
+ * message, which also has to be dispatched.
+ * Above we sent 2*n messages, which means
+ * we have to dispatch 4*n times.
+ */
+
+ while (pong_count < n*2) {
ret = tevent_loop_once(evt_ctx);
if (ret != 0) {
break;
}
}
- if (pong_count != 2) {
- fprintf(stderr, "Duplicate filter failed (%d).\n", pong_count);
+ if (pong_count != 2*n) {
+ fprintf(stderr, "Message count failed (%d).\n", pong_count);
}
/* Speed testing */