Skip to content

Commit

Permalink
Seed rng for proper random partitioning, jitters, etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhill committed May 3, 2016
1 parent 82971a3 commit b79896c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions kafkacat.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <signal.h>
#include <sys/time.h>
#include <syslog.h>
#include <sys/types.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -1243,11 +1244,16 @@ static void conf_dump (void) {
int main (int argc, char **argv) {
char tmp[16];
FILE *in = stdin;
struct timeval tv;

signal(SIGINT, term);
signal(SIGTERM, term);
signal(SIGPIPE, term);

/* Seed rng for random partitioner, jitter, etc. */
gettimeofday(&tv, NULL);
srand(tv.tv_usec);

/* Create config containers */
conf.rk_conf = rd_kafka_conf_new();
conf.rkt_conf = rd_kafka_topic_conf_new();
Expand Down

0 comments on commit b79896c

Please sign in to comment.