Changeset 3336 for pjproject/trunk


Ignore:
Timestamp:
Oct 11, 2010 10:59:37 AM (14 years ago)
Author:
ming
Message:

Fix #1145: API to enable/disable support for iOS BG feature during runtime

Location:
pjproject/trunk/pjlib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/include/pj/activesock.h

    r3299 r3336  
    317317PJ_DECL(void) pj_activesock_set_iphone_os_bg(pj_activesock_t *asock, 
    318318                                             int val); 
     319 
     320/** 
     321 * Enable/disable support for iPhone OS background mode. This setting 
     322 * will apply globally and will affect any active sockets created 
     323 * afterwards, if you want to change the setting for a particular 
     324 * active socket, use #pj_activesock_set_iphone_os_bg() instead. 
     325 * By default, this setting is enabled. 
     326 * 
     327 * @param val       The value of global background mode setting. 
     328 * 
     329 */ 
     330PJ_DECL(void) pj_activesock_enable_iphone_os_bg(pj_bool_t val); 
    319331#endif 
    320332 
  • pjproject/trunk/pjlib/src/pj/activesock.c

    r3317 r3336  
    3030    PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT!=0 
    3131#   include <CFNetwork/CFNetwork.h> 
     32 
     33    static pj_bool_t ios_bg_support = PJ_TRUE; 
    3234#endif 
    3335 
     
    134136static void activesock_create_iphone_os_stream(pj_activesock_t *asock) 
    135137{ 
    136     if (asock->bg_setting && asock->stream_oriented) { 
     138    if (ios_bg_support && asock->bg_setting && asock->stream_oriented) { 
    137139        activesock_destroy_iphone_os_stream(asock); 
    138140 
     
    164166    else 
    165167        activesock_destroy_iphone_os_stream(asock); 
     168} 
     169 
     170PJ_DEF(void) pj_activesock_enable_iphone_os_bg(pj_bool_t val) 
     171{ 
     172    ios_bg_support = val; 
    166173} 
    167174#endif 
Note: See TracChangeset for help on using the changeset viewer.