mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-22 12:52:33 +00:00
Bug 6873 - Finish moving from the non-threadsafe (and poor randomness) rand() to threadsafe ast_random()
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@17627 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1992,7 +1992,7 @@ static int calc_metric(struct ast_call_queue *q, struct member *mem, int pos, st
|
||||
tmp->metric += mem->penalty * 1000000;
|
||||
break;
|
||||
case QUEUE_STRATEGY_RANDOM:
|
||||
tmp->metric = rand() % 1000;
|
||||
tmp->metric = ast_random() % 1000;
|
||||
tmp->metric += mem->penalty * 1000000;
|
||||
break;
|
||||
case QUEUE_STRATEGY_FEWESTCALLS:
|
||||
@@ -2241,7 +2241,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
|
||||
else {
|
||||
/* Last ditch effort -- no CDR, make up something */
|
||||
char tmpid[256];
|
||||
snprintf(tmpid, sizeof(tmpid), "chan-%x", rand());
|
||||
snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random());
|
||||
ast_monitor_start(which, qe->parent->monfmt, tmpid, 1 );
|
||||
}
|
||||
if (qe->parent->monjoin)
|
||||
|
Reference in New Issue
Block a user