the given amount of messages in the configured interval.
The previous behavior allowed n+2 messages in the interval, due to
two off by one comparison rules.
In addition, if flooding is detected then each new message after the flooding
is detected will reset the interval timer, which means the client
cannot send another message until the timeout interval expires.
This used to be a linear search O(n), but is now done
as a red-black tree O(log n) instead.
These operations can be further opimized with a hash-table
which would acheive near constant time lookups.
- Added a list_remove_first() which is generally better than list_remove()
provided you want to remove the first element.
- Added a list_append_list() to append and move all nodes from one list to
another.
Previously you would have to do something like this:
for (type foo = (type) list_get_first(list); foo; foo = (type) list_get_next(list)
{
/* code */
}
Now, you can instead write this as:
LIST_FOREACH(type, foo, list,
{
/* code */
})
Basically, boilerplate stuff including the casting is gone.
for certain lookups.
The rb_tree will act as a general purpose key/value storage, and
also give a performance boost in the cases where the other
simple alternative would be to use a linked_list.
On average this should give on average O(log n) lookups, while the linked_list
would be O(n) at worst.
A struct plugin_hub_internals was falsely casted to struct
plugin_callback_data. This caused the contained commands list pointer to point to
a struct hub_info and commands->size took the value of a pointer to a struct
net_connection. Since size is increased/decreased every time an item is
added to/removed from the list, this resulted in some funny crashes.
This fix is a little dirty as it exports some internals.
- Don't link with -ldl, as it is not needed in most cases
- Don't compile plugins if USE_PLUGINS=NO
- Fix warning about missing newline at end of getopt.h
- Removed the O_NOATIME open() flag from the logging plugin.
- Removed the O_LARGEFILE open() flag. _FILE_OFFSET_BITS is 64.
- Use fsync() if fdatasync() is not available for log file writing.
- Replaced some sprintf() with snprintf() due to compiler warnings (though, they were length limited otherwise).
- Replaced two occurences of strcpy() with memcpy().
and comments.
This allows for:
'"foo bar"' can be represented as 'foo\ bar'.
And allows for comments using the hash symbol (#), but not inside
escapes or quotes. "#this is not a comment", \#this\ is\ not\ a comment.
All configuration file parsers should be rewritten using this functionality.