mgw: Find and store RTP conn local_addr once during CRCX handling
It doesn't make sense to call the function several times since anyway we
are only binding during
allocate_port()->mgcp_bind_net_rtp_port()->bind_rtp()->mgcp_create_bind()->osmo_sock_init2().
Let's better calculate the local IP addr once and use that stored value.
THis is a previous step towards next commit updating the local IP addr
and re-bindng if encessary.
Change-Id: I803b99c5e5fe0f92a5bf6796d8c25df88d1608e6
diff --git a/src/libosmo-mgcp/mgcp_network.c b/src/libosmo-mgcp/mgcp_network.c
index 84f3604..75a4754 100644
--- a/src/libosmo-mgcp/mgcp_network.c
+++ b/src/libosmo-mgcp/mgcp_network.c
@@ -1620,7 +1620,6 @@
{
char name[512];
struct mgcp_rtp_end *end;
- char local_ip_addr[INET6_ADDRSTRLEN];
snprintf(name, sizeof(name), "%s-%s", conn->conn->name, conn->conn->id);
end = &conn->end;
@@ -1643,9 +1642,7 @@
end->rtcp.data = conn;
end->rtcp.cb = rtp_data_net;
- mgcp_get_local_addr(local_ip_addr, conn);
-
- return bind_rtp(endp->cfg, local_ip_addr, end, endp);
+ return bind_rtp(endp->cfg, conn->end.local_addr, end, endp);
}
/*! free allocated RTP and RTCP ports.