Ignore:
Timestamp:
Jun 26, 2007 12:20:37 PM (17 years ago)
Author:
bennylp
Message:

Ticket #345: Option to select random start port in pjsua

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip-apps/src/pjsua/pjsua_app.c

    r1391 r1394  
    716716        case OPT_RTP_PORT: 
    717717            cfg->rtp_cfg.port = my_atoi(pj_optarg); 
     718            if (cfg->rtp_cfg.port == 0) { 
     719                enum { START_PORT=4000 }; 
     720                unsigned range; 
     721 
     722                range = (65535-START_PORT-PJSUA_MAX_CALLS*2); 
     723                cfg->rtp_cfg.port = START_PORT +  
     724                                    ((pj_rand() % range) & 0xFFFE); 
     725            } 
     726 
    718727            if (cfg->rtp_cfg.port < 1 || cfg->rtp_cfg.port > 65535) { 
    719728                PJ_LOG(1,(THIS_FILE, 
Note: See TracChangeset for help on using the changeset viewer.