Ignore:
Timestamp:
Apr 15, 2019 10:52:16 AM (6 years ago)
Author:
nanang
Message:

Close #2189: fixed PJSUA2 thread safety issue in list of objects manipulation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua2/account.cpp

    r5837 r5969  
    10291029} 
    10301030 
     1031BuddyVector2 Account::enumBuddies2() const throw(Error) 
     1032{ 
     1033    BuddyVector2 bv2; 
     1034    pjsua_buddy_id ids[PJSUA_MAX_BUDDIES]; 
     1035    unsigned i, count = PJSUA_MAX_BUDDIES; 
     1036 
     1037    PJSUA2_CHECK_EXPR( pjsua_enum_buddies(ids, &count) ); 
     1038    for (i = 0; i < count; ++i) { 
     1039        bv2.push_back(Buddy(ids[i])); 
     1040    } 
     1041 
     1042    return bv2; 
     1043} 
     1044 
    10311045Buddy* Account::findBuddy(string uri, FindBuddyMatch *buddy_match) const 
    10321046                throw(Error) 
     
    10421056    } 
    10431057    PJSUA2_RAISE_ERROR(PJ_ENOTFOUND); 
     1058} 
     1059 
     1060Buddy Account::findBuddy2(string uri) const throw(Error) 
     1061{ 
     1062    pj_str_t pj_uri; 
     1063    pjsua_buddy_id id; 
     1064 
     1065    pj_strset2(&pj_uri, (char*)uri.c_str()); 
     1066 
     1067    id = pjsua_buddy_find(&pj_uri); 
     1068    if (id == PJSUA_INVALID_ID) { 
     1069        PJSUA2_RAISE_ERROR(PJ_ENOTFOUND); 
     1070    } 
     1071 
     1072    Buddy buddy(id); 
     1073    return buddy; 
    10441074} 
    10451075 
Note: See TracChangeset for help on using the changeset viewer.