changeset 221:0eaf93997170 noffle

[svn] generate MessageID with pid and index number, not with random number.
author mirkol
date Sun, 02 Dec 2001 19:32:44 +0000
parents 81277bc2c264
children bf290632d29e
files src/protocol.c
diffstat 1 files changed, 3 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocol.c	Sun Dec 02 19:31:48 2001 +0000
+++ b/src/protocol.c	Sun Dec 02 19:32:44 2001 +0000
@@ -1,7 +1,7 @@
 /*
   protocol.c
 
-  $Id: protocol.c 316 2001-10-31 11:44:53Z bears $
+  $Id: protocol.c 340 2001-12-02 19:32:44Z mirkol $
 */
 
 #if HAVE_CONFIG_H
@@ -307,21 +307,12 @@
 {
     Str domain, date;
     time_t t;
-    static Bool randSeeded = FALSE;
+    static long count = 0; 
 
-    if ( ! randSeeded )
-    {
-	struct timeval tv;
-	struct timezone tz;
-
-	if ( gettimeofday( &tv, &tz ) == 0 )
-	    srand( (unsigned int) tv.tv_usec );
-	randSeeded = TRUE;
-    }
     getDomain( domain, from );
     time( &t );
     strftime( date, MAXCHAR, "%Y%m%d%H%M%S", gmtime( &t ) );
-    snprintf( msgId, MAXCHAR, "<%s.%X.%s@%s>", date, rand(), suffix, domain );
+    snprintf( msgId, MAXCHAR, "<%s.%X.%lx.%s@%s>", date, getpid(), count++ ,suffix, domain );
     ASSERT( Prt_isValidMsgId( msgId ) );
 }