del_work(&message_work);
}
+unsigned int lcr_random = 0;
+
/* creates a new message with the given attributes. the message must be filled then. after filling, the message_put must be called */
struct lcr_msg *message_create(int id_from, int id_to, int flow, int type)
{
struct lcr_msg *message;
+ struct timeval now_tv;
+ struct timezone now_tz;
+
+ gettimeofday(&now_tv, &now_tz);
+ lcr_random = (lcr_random << 1) | (lcr_random >> 31);
+ lcr_random ^= now_tv.tv_sec;
+ lcr_random ^= now_tv.tv_usec;
message = (struct lcr_msg *)MALLOC(sizeof(struct lcr_msg));
if (!message)
}
/* attaches a message to the end of the message chain */
-void message_put(struct lcr_msg *message)
+void _message_put(struct lcr_msg *message, const char *file, int line)
{
if (message->id_to == 0) {
PDEBUG(DEBUG_MSG, "message %s not written, because destination is 0.\n", messages_txt[message->type]);
return;
}
- if ((options.deb&DEBUG_MSG) && message->type != MESSAGE_DATA)
- PDEBUG(DEBUG_MSG, "message %s written from %ld to %ld (memory %x)\n", messages_txt[message->type], message->id_from, message->id_to, message);
+ if ((options.deb & DEBUG_MSG))
+ PDEBUG(DEBUG_MSG, "message %s written from %ld to %ld (memory %x at file %s, line %d)\n", messages_txt[message->type], message->id_from, message->id_to, message, file, line);
*messagepointer_end = message;
messagepointer_end = &(message->next);
message->keep = 0;
- if ((options.deb&DEBUG_MSG) && message->type != MESSAGE_DATA)
-
+ if ((options.deb & DEBUG_MSG))
PDEBUG(DEBUG_MSG, "message %s reading from %ld to %ld (memory %x)\n", messages_txt[message->type], message->id_from, message->id_to, message);
return(message);