"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/flt_spoe.c" between
haproxy-2.0.13.tar.gz and haproxy-2.0.14.tar.gz

About: HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments. LTS (Long-Term Support) release.

flt_spoe.c  (haproxy-2.0.13):flt_spoe.c  (haproxy-2.0.14)
skipping to change at line 271 skipping to change at line 271
uint64_t last = 0; uint64_t last = 0;
int byte = 0; int byte = 0;
uint8_t bits = 0; uint8_t bits = 0;
unsigned int rand_max_bits = my_flsl(RAND_MAX); unsigned int rand_max_bits = my_flsl(RAND_MAX);
if ((uuid = calloc(1, 37)) == NULL) if ((uuid = calloc(1, 37)) == NULL)
return NULL; return NULL;
while (byte < 4) { while (byte < 4) {
while (bits < 32) { while (bits < 32) {
last |= (uint64_t)random() << bits; last |= (uint64_t)ha_random() << bits;
bits += rand_max_bits; bits += rand_max_bits;
} }
rnd[byte++] = last; rnd[byte++] = last;
last >>= 32u; last >>= 32u;
bits -= 32; bits -= 32;
} }
snprintf(uuid, 37, "%8.8x-%4.4x-%4.4x-%4.4x-%12.12llx", snprintf(uuid, 37, "%8.8x-%4.4x-%4.4x-%4.4x-%12.12llx",
rnd[0], rnd[0],
rnd[1] & 0xFFFF, rnd[1] & 0xFFFF,
((rnd[1] >> 16u) & 0xFFF) | 0x4000, // highest 4 bi ts indicate the uuid version ((rnd[1] >> 16u) & 0xFFF) | 0x4000, // highest 4 bi ts indicate the uuid version
skipping to change at line 3112 skipping to change at line 3112
} }
/* Initializes the SPOE filter for a proxy for a specific thread. /* Initializes the SPOE filter for a proxy for a specific thread.
* Returns a negative value if an error occurs. */ * Returns a negative value if an error occurs. */
static int static int
spoe_init_per_thread(struct proxy *p, struct flt_conf *fconf) spoe_init_per_thread(struct proxy *p, struct flt_conf *fconf)
{ {
struct spoe_config *conf = fconf->conf; struct spoe_config *conf = fconf->conf;
struct spoe_agent *agent = conf->agent; struct spoe_agent *agent = conf->agent;
/* Use a != seed per process */
if (relative_pid > 1 && tid == 0)
srandom(now_ms * pid);
agent->rt[tid].engine_id = generate_pseudo_uuid(); agent->rt[tid].engine_id = generate_pseudo_uuid();
if (agent->rt[tid].engine_id == NULL) if (agent->rt[tid].engine_id == NULL)
return -1; return -1;
return 0; return 0;
} }
/************************************************************************** /**************************************************************************
* Hooks attached to a stream * Hooks attached to a stream
*************************************************************************/ *************************************************************************/
/* Called when a filter instance is created and attach to a stream. It creates /* Called when a filter instance is created and attach to a stream. It creates
 End of changes. 2 change blocks. 
5 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)