rtp_proxytable_t.opposite_entry has been changed to zero-based index

This commit is contained in:
Thomas Ries 2016-08-30 20:27:49 +00:00
parent ccfc3ef5bb
commit 19c31266ff
2 changed files with 7 additions and 7 deletions

View File

@ -58,7 +58,7 @@ typedef struct {
struct in_addr remote_ipaddr; /* remote IP */ struct in_addr remote_ipaddr; /* remote IP */
int remote_port; /* remote port */ int remote_port; /* remote port */
time_t timestamp; /* last 'stream alive' TS */ time_t timestamp; /* last 'stream alive' TS */
int opposite_entry; /* 1 based!! index of opposite entry */ int opposite_entry; /* 0 based index of opposite entry */
} rtp_proxytable_t; } rtp_proxytable_t;
/* /*

View File

@ -441,8 +441,8 @@ static void *rtpproxy_main(void *arg) {
* This allows silence (no data) on one direction without breaking * This allows silence (no data) on one direction without breaking
* the connection after the RTP timeout */ * the connection after the RTP timeout */
rtp_proxytable[i].timestamp=current_tv.tv_sec; rtp_proxytable[i].timestamp=current_tv.tv_sec;
if (rtp_proxytable[i].opposite_entry > 0) { if (rtp_proxytable[i].opposite_entry >= 0) {
rtp_proxytable[rtp_proxytable[i].opposite_entry-1].timestamp= rtp_proxytable[rtp_proxytable[i].opposite_entry].timestamp=
current_tv.tv_sec; current_tv.tv_sec;
} }
} /* if */ } /* if */
@ -930,8 +930,8 @@ int rtp_relay_stop_fwd (osip_call_id_t *callid,
rtp_proxytable[i].remote_ipaddr, rtp_proxytable[i].remote_ipaddr,
rtp_proxytable[i].remote_port + 1); rtp_proxytable[i].remote_port + 1);
/* clean up */ /* clean up */
if (rtp_proxytable[i].opposite_entry) { if (rtp_proxytable[i].opposite_entry >= 0) {
rtp_proxytable[rtp_proxytable[i].opposite_entry-1].opposite_entry=0; rtp_proxytable[rtp_proxytable[i].opposite_entry].opposite_entry=-1;
} }
memset(&rtp_proxytable[i], 0, sizeof(rtp_proxytable[0])); memset(&rtp_proxytable[i], 0, sizeof(rtp_proxytable[0]));
got_match=1; got_match=1;
@ -1078,8 +1078,8 @@ static int match_socket (int rtp_proxytable_idx) {
strcpy(remip2, utils_inet_ntoa(rtp_proxytable[rtp_proxytable_idx].remote_ipaddr)); strcpy(remip2, utils_inet_ntoa(rtp_proxytable[rtp_proxytable_idx].remote_ipaddr));
strcpy(lclip2, utils_inet_ntoa(rtp_proxytable[rtp_proxytable_idx].local_ipaddr)); strcpy(lclip2, utils_inet_ntoa(rtp_proxytable[rtp_proxytable_idx].local_ipaddr));
rtp_proxytable[rtp_proxytable_idx].opposite_entry=j+1; rtp_proxytable[rtp_proxytable_idx].opposite_entry=j;
rtp_proxytable[j].opposite_entry=rtp_proxytable_idx+1; rtp_proxytable[j].opposite_entry=rtp_proxytable_idx;
DEBUGC(DBCLASS_RTP, "connected entry %i (fd=%i, %s:%i->%s:%i) <-> entry %i (fd=%i, %s:%i->%s:%i)", DEBUGC(DBCLASS_RTP, "connected entry %i (fd=%i, %s:%i->%s:%i) <-> entry %i (fd=%i, %s:%i->%s:%i)",
j, rtp_proxytable[j].rtp_rx_sock, j, rtp_proxytable[j].rtp_rx_sock,