X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=message.c;h=cfda36be28f839b268e4c79f67fb3119c0b490a4;hp=e2f01ec80c6373f17c890eca3addecda5f5695e6;hb=refs%2Fheads%2Fbackup2;hpb=b0bd74e35e935aa976b68c594def4e8d2c22ef95 diff --git a/message.c b/message.c index e2f01ec..cfda36b 100644 --- a/message.c +++ b/message.c @@ -30,10 +30,19 @@ void cleanup_message(void) 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) @@ -49,7 +58,7 @@ struct lcr_msg *message_create(int id_from, int id_to, int flow, int type) } /* 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]); @@ -57,8 +66,8 @@ void message_put(struct lcr_msg *message) 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); @@ -102,8 +111,7 @@ struct lcr_msg *message_get(void) 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);