Changeset 2701


Ignore:
Timestamp:
May 17, 2009 3:34:26 PM (11 years ago)
Author:
nanang
Message:

Ticket #849: Updated conf switch to force destination port to be available for the new connection.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/sipit24/pjmedia/src/pjmedia/conf_switch.c

    r2581 r2701  
    554554    } 
    555555     
    556     /* Check if sink is listening to other ports */ 
     556    /* If sink is currently listening to other ports, it needs to be released 
     557     * first before the new connection made. 
     558     */  
    557559    if (dst_port->transmitter_cnt > 0) { 
    558         pj_mutex_unlock(conf->mutex); 
    559         return PJ_ETOOMANYCONN; 
     560        unsigned j; 
     561        pj_bool_t transmitter_found = PJ_FALSE; 
     562 
     563        pj_assert(dst_port->transmitter_cnt == 1); 
     564        for (j=0; j<conf->max_ports && !transmitter_found; ++j) { 
     565            if (conf->ports[j]) { 
     566                unsigned k; 
     567 
     568                for (k=0; k < conf->ports[j]->listener_cnt; ++k) { 
     569                    if (conf->ports[j]->listener_slots[k] == sink_slot) { 
     570                        PJ_LOG(4,(THIS_FILE, "Connection [%d->%d] is " 
     571                                  "disconnected forcedly for the new " 
     572                                  "connection [%d->%d]", 
     573                                  j, sink_slot, src_slot, sink_slot)); 
     574                        pjmedia_conf_disconnect_port(conf, j, sink_slot); 
     575                        transmitter_found = PJ_TRUE; 
     576                        break; 
     577                    } 
     578                } 
     579            } 
     580        } 
     581        pj_assert(dst_port->transmitter_cnt == 0); 
    560582    } 
    561583 
Note: See TracChangeset for help on using the changeset viewer.