Change how we set the local and remote address.

The code will now only change the address and port. It will not overwrite any other values.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@187773 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Joshua Colp
2009-04-10 18:14:47 +00:00
parent 8e4b5df187
commit aaf1566222
2 changed files with 11 additions and 9 deletions

View File

@@ -406,13 +406,11 @@ static int ast_rtp_new(struct ast_rtp_instance *instance, struct sched_context *
startplace = x;
for (;;) {
struct sockaddr_in local_address = { 0, };
local_address.sin_port = htons(x);
sin->sin_port = htons(x);
/* Try to bind, this will tell us whether the port is available or not */
if (!bind(rtp->s, (struct sockaddr*)&local_address, sizeof(local_address))) {
if (!bind(rtp->s, (struct sockaddr *)sin, sizeof(*sin))) {
ast_debug(1, "Allocated port %d for RTP instance '%p'\n", x, instance);
ast_rtp_instance_set_local_address(instance, &local_address);
ast_rtp_instance_set_local_address(instance, sin);
break;
}