Changeset 1815 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
- Timestamp:
- Feb 21, 2008 9:36:34 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c
r1735 r1815 512 512 513 513 514 /* Init random seed */ 515 static void init_random_seed(void) 516 { 517 pj_sockaddr addr; 518 const pj_str_t *hostname; 519 pj_uint32_t pid; 520 pj_time_val t; 521 unsigned seed=0; 522 523 /* Add hostname */ 524 hostname = pj_gethostname(); 525 seed = pj_hash_calc(seed, hostname->ptr, (int)hostname->slen); 526 527 /* Add primary IP address */ 528 if (pj_gethostip(pj_AF_INET(), &addr)==PJ_SUCCESS) 529 seed = pj_hash_calc(seed, &addr.ipv4.sin_addr, 4); 530 531 /* Get timeofday */ 532 pj_gettimeofday(&t); 533 seed = pj_hash_calc(seed, &t, sizeof(t)); 534 535 /* Add PID */ 536 pid = pj_getpid(); 537 seed = pj_hash_calc(seed, &pid, sizeof(pid)); 538 539 /* Init random seed */ 540 pj_srand(seed); 541 } 542 514 543 /* 515 544 * Instantiate pjsua application. … … 529 558 PJ_ASSERT_RETURN(status == PJ_SUCCESS, status); 530 559 560 /* Init random seed */ 561 init_random_seed(); 531 562 532 563 /* Init PJLIB-UTIL: */
Note: See TracChangeset
for help on using the changeset viewer.