int maxage; /**< Maximum age of messages */
int maxnum; /**< Maximum number of messages */
struct callback *msg_cleanup_cb; /**< Callback to clean up the messages */
- struct event_idle *msg_cleanup_ev; /**< Idle event to clean up the messages */
+ struct event_timeout *msg_cleanup_to; /**< Idle event to clean up the messages */
};
int
i = 0;
while (msg && (i < this_->maxnum)) {
- if ((now - msg->time) > this_->maxage) {
+ if ((this_->maxage > 0) && (now - msg->time) > this_->maxage) {
break;
}
messagelist_init(struct messagelist *this_)
{
this_->msg_cleanup_cb = callback_new_1(callback_cast(message_cleanup), this_);
- this_->msg_cleanup_ev = event_add_idle(150, this_->msg_cleanup_cb);
+ this_->msg_cleanup_to = event_add_timeout(1000, 1, this_->msg_cleanup_cb);
}
struct message