Changeset 2130 for pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
- Timestamp:
- Jul 13, 2008 12:24:55 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_pres.c
r2118 r2130 174 174 static void reset_buddy(pjsua_buddy_id id) 175 175 { 176 pj_pool_t *pool = pjsua_var.buddy[id].pool; 176 177 pj_bzero(&pjsua_var.buddy[id], sizeof(pjsua_var.buddy[id])); 178 pjsua_var.buddy[id].pool = pool; 177 179 pjsua_var.buddy[id].index = id; 178 180 } … … 186 188 { 187 189 pjsip_name_addr *url; 190 pjsua_buddy *buddy; 188 191 pjsip_sip_uri *sip_uri; 189 192 int index; … … 210 213 } 211 214 215 buddy = &pjsua_var.buddy[index]; 216 217 /* Create pool for this buddy */ 218 if (buddy->pool) { 219 pj_pool_reset(buddy->pool); 220 } else { 221 char name[PJ_MAX_OBJ_NAME]; 222 pj_ansi_snprintf(name, sizeof(name), "buddy%03d", index); 223 buddy->pool = pjsua_pool_create(name, 512, 256); 224 } 212 225 213 226 /* Get name and display name for buddy */ 214 pj_strdup_with_null( pjsua_var.pool, &tmp, &cfg->uri);215 url = (pjsip_name_addr*)pjsip_parse_uri( pjsua_var.pool, tmp.ptr, tmp.slen,227 pj_strdup_with_null(buddy->pool, &tmp, &cfg->uri); 228 url = (pjsip_name_addr*)pjsip_parse_uri(buddy->pool, tmp.ptr, tmp.slen, 216 229 PJSIP_PARSE_URI_AS_NAMEADDR); 217 230 218 231 if (url == NULL) { 219 232 pjsua_perror(THIS_FILE, "Unable to add buddy", PJSIP_EINVALIDURI); 233 pj_pool_release(buddy->pool); 234 buddy->pool = NULL; 220 235 PJSUA_UNLOCK(); 221 236 return PJSIP_EINVALIDURI; … … 223 238 224 239 /* Only support SIP schemes */ 225 if (!PJSIP_URI_SCHEME_IS_SIP(url) && !PJSIP_URI_SCHEME_IS_SIPS(url)) 240 if (!PJSIP_URI_SCHEME_IS_SIP(url) && !PJSIP_URI_SCHEME_IS_SIPS(url)) { 241 pj_pool_release(buddy->pool); 242 buddy->pool = NULL; 243 PJSUA_UNLOCK(); 226 244 return PJSIP_EINVALIDSCHEME; 245 } 227 246 228 247 /* Reset buddy, to make sure everything is cleared with default … … 1050 1069 1051 1070 buddy->contact.ptr = (char*) 1052 pj_pool_alloc( pjsua_var.pool, PJSIP_MAX_URL_SIZE);1071 pj_pool_alloc(buddy->pool, PJSIP_MAX_URL_SIZE); 1053 1072 buddy->contact.slen = pjsip_uri_print( PJSIP_URI_IN_CONTACT_HDR, 1054 1073 contact_hdr->uri, … … 1117 1136 static void subscribe_buddy_presence(unsigned index) 1118 1137 { 1138 pj_pool_t *tmp_pool = NULL; 1119 1139 pjsua_buddy *buddy; 1120 1140 int acc_id; … … 1138 1158 contact = acc->contact; 1139 1159 } else { 1140 status = pjsua_acc_create_uac_contact(pjsua_var.pool, &contact, 1160 tmp_pool = pjsua_pool_create("tmpbuddy", 512, 256); 1161 1162 status = pjsua_acc_create_uac_contact(tmp_pool, &contact, 1141 1163 acc_id, &buddy->uri); 1142 1164 if (status != PJ_SUCCESS) { 1143 1165 pjsua_perror(THIS_FILE, "Unable to generate Contact header", 1144 1166 status); 1167 pj_pool_release(tmp_pool); 1145 1168 return; 1146 1169 } … … 1156 1179 pjsua_perror(THIS_FILE, "Unable to create dialog", 1157 1180 status); 1181 if (tmp_pool) pj_pool_release(tmp_pool); 1158 1182 return; 1159 1183 } … … 1166 1190 status); 1167 1191 pjsip_dlg_terminate(buddy->dlg); 1192 if (tmp_pool) pj_pool_release(tmp_pool); 1168 1193 return; 1169 1194 } … … 1203 1228 pjsua_perror(THIS_FILE, "Unable to create initial SUBSCRIBE", 1204 1229 status); 1230 if (tmp_pool) pj_pool_release(tmp_pool); 1205 1231 return; 1206 1232 } … … 1216 1242 pjsua_perror(THIS_FILE, "Unable to send initial SUBSCRIBE", 1217 1243 status); 1244 if (tmp_pool) pj_pool_release(tmp_pool); 1218 1245 return; 1219 1246 } 1247 1248 if (tmp_pool) pj_pool_release(tmp_pool); 1220 1249 } 1221 1250
Note: See TracChangeset
for help on using the changeset viewer.