aboutsummaryrefslogtreecommitdiffstats
path: root/rtp.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-05 17:44:44 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-04-05 17:44:44 +0000
commite0ba99b7f5b9f06dda7fe4baa8a7fb90e2ab40c8 (patch)
tree6334c0ffd529b865c510fbfb7a06b71e2c6d6ceb /rtp.c
parent54a140d030be645458cc82416501f0386e1d9e4b (diff)
Bug 6873 - Finish moving from the non-threadsafe (and poor randomness) rand() to threadsafe ast_random()
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@17627 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'rtp.c')
-rw-r--r--rtp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/rtp.c b/rtp.c
index b1a36ef22..475ba487d 100644
--- a/rtp.c
+++ b/rtp.c
@@ -1008,8 +1008,8 @@ struct ast_rtp *ast_rtp_new_with_bindaddr(struct sched_context *sched, struct io
rtp->them.sin_family = AF_INET;
rtp->us.sin_family = AF_INET;
rtp->s = rtp_socket();
- rtp->ssrc = rand();
- rtp->seqno = rand() & 0xffff;
+ rtp->ssrc = ast_random();
+ rtp->seqno = ast_random() & 0xffff;
if (rtp->s < 0) {
free(rtp);
ast_log(LOG_ERROR, "Unable to allocate socket: %s\n", strerror(errno));
@@ -1021,7 +1021,7 @@ struct ast_rtp *ast_rtp_new_with_bindaddr(struct sched_context *sched, struct io
}
/* Select a random port number in the range of possible RTP */
- x = (rand() % (rtpend-rtpstart)) + rtpstart;
+ x = (ast_random() % (rtpend-rtpstart)) + rtpstart;
x = x & ~1;
/* Save it for future references. */
startplace = x;