Ignore:
Timestamp:
Oct 26, 2007 5:25:35 AM (17 years ago)
Author:
bennylp
Message:

Ticket #403: Ability to specify RConnection instance etc in PJLIB Symbian

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/os_core_symbian.cpp

    r1405 r1525  
    154154PjSymbianOS::PjSymbianOS() 
    155155: isSocketServInitialized_(false), isResolverInitialized_(false), 
    156   console_(NULL), selectTimeoutTimer_(NULL) 
    157 { 
     156  console_(NULL), selectTimeoutTimer_(NULL), 
     157  appSocketServ_(NULL), appConnection_(NULL), appHostResolver_(NULL) 
     158{ 
     159} 
     160 
     161// Set parameters 
     162void PjSymbianOS::SetParameters(pj_symbianos_params *params)  
     163{ 
     164    appSocketServ_ = (RSocketServ*) params->rsocketserv; 
     165    appConnection_ = (RConnection*) params->rconnection; 
     166    appHostResolver_ = (RHostResolver*) params->rhostresolver; 
    158167} 
    159168 
     
    180189#endif 
    181190 
    182     if (!isSocketServInitialized_) { 
     191    /* Only create RSocketServ if application doesn't specify it 
     192     * in the parameters 
     193     */ 
     194    if (!isSocketServInitialized_ && appSocketServ_ == NULL) { 
    183195        err = socketServ_.Connect(); 
    184196        if (err != KErrNone) 
     
    188200    } 
    189201 
    190     if (!isResolverInitialized_) { 
    191         err = hostResolver_.Open(SocketServ(), KAfInet, KSockStream); 
     202    if (!isResolverInitialized_ && appHostResolver_ == NULL) { 
     203        if (Connection()) 
     204            err = hostResolver_.Open(SocketServ(), KAfInet, KSockStream, 
     205                                     *Connection()); 
     206        else 
     207            err = hostResolver_.Open(SocketServ(), KAfInet, KSockStream); 
     208         
    192209        if (err != KErrNone) 
    193210            goto on_error; 
     
    258275{ 
    259276    return 0; 
     277} 
     278 
     279 
     280/* Set Symbian specific parameters */ 
     281PJ_DEF(pj_status_t) pj_symbianos_set_params(pj_symbianos_params *prm)  
     282{ 
     283    PJ_ASSERT_RETURN(prm != NULL, PJ_EINVAL); 
     284    PjSymbianOS::Instance()->SetParameters(prm); 
     285    return PJ_SUCCESS; 
    260286} 
    261287 
Note: See TracChangeset for help on using the changeset viewer.