- Timestamp:
- Jan 7, 2006 11:01:13 PM (19 years ago)
- Location:
- pjproject/trunk/pjsip/src/pjsip
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_transaction.c
r109 r110 893 893 void *event_src ) 894 894 { 895 pjsip_tsx_state_e prev_state = tsx->state; 896 895 897 PJ_LOG(5, (tsx->obj_name, "State changed from %s to %s, event=%s", 896 898 state_str[tsx->state], state_str[state], … … 910 912 if (tsx->tsx_user && tsx->tsx_user->on_tsx_state) { 911 913 pjsip_event e; 912 PJSIP_EVENT_INIT_TSX_STATE(e, tsx, event_src_type, event_src); 914 PJSIP_EVENT_INIT_TSX_STATE(e, tsx, event_src_type, event_src, 915 prev_state); 913 916 (*tsx->tsx_user->on_tsx_state)(tsx, &e); 914 917 } … … 2107 2110 pjsip_endpt_schedule_timer( tsx->endpt, &tsx->timeout_timer, &timeout); 2108 2111 2109 /* Inform TU. */ 2112 /* Inform TU. 2113 * blp: You might be tempted to move this notification before 2114 * sending ACK, but I think you shouldn't. Better set-up 2115 * everything before calling tsx_user's callback to avoid 2116 * mess up. 2117 */ 2110 2118 tsx_set_state( tsx, PJSIP_TSX_STATE_COMPLETED, 2111 2119 PJSIP_EVENT_RX_MSG, event->body.rx_msg.rdata ); -
pjproject/trunk/pjsip/src/pjsip/sip_transport_loop.c
r109 r110 254 254 { 255 255 struct loop_transport *loop = arg; 256 struct recv_list r; 257 struct send_list s; 258 259 pj_list_init(&r); 260 pj_list_init(&s); 256 261 257 262 while (!loop->thread_quit_flag) { … … 263 268 pj_lock_acquire(loop->base.lock); 264 269 265 /* Process pending send notification. */270 /* Move expired send notification to local list. */ 266 271 while (!pj_list_empty(&loop->send_list)) { 267 272 struct send_list *node = loop->send_list.next; … … 270 275 if (PJ_TIME_VAL_GTE(node->sent_time, now)) 271 276 break; 277 278 /* Delete this from the list. */ 279 pj_list_erase(node); 280 281 /* Add to local list. */ 282 pj_list_push_back(&s, node); 283 } 284 285 /* Move expired "incoming" packet to local list. */ 286 while (!pj_list_empty(&loop->recv_list)) { 287 struct recv_list *node = loop->recv_list.next; 288 289 /* Break when next node time is greater than now. */ 290 if (PJ_TIME_VAL_GTE(node->rdata.pkt_info.timestamp, now)) 291 break; 292 293 /* Delete this from the list. */ 294 pj_list_erase(node); 295 296 /* Add to local list. */ 297 pj_list_push_back(&r, node); 298 299 } 300 301 pj_lock_release(loop->base.lock); 302 303 /* Process send notification and incoming packet notification 304 * without holding down the loop's mutex. 305 */ 306 while (!pj_list_empty(&s)) { 307 struct send_list *node = s.next; 308 309 pj_list_erase(node); 272 310 273 311 /* Notify callback. */ … … 276 314 } 277 315 278 /* Delete this from the list. */279 pj_list_erase(node);280 281 316 /* Decrement tdata reference counter. */ 282 317 pjsip_tx_data_dec_ref(node->tdata); 283 318 } 284 319 285 /* Process "incoming" packet s. */286 while (!pj_list_empty(& loop->recv_list)) {287 struct recv_list *node = loop->recv_list.next;320 /* Process "incoming" packet. */ 321 while (!pj_list_empty(&r)) { 322 struct recv_list *node = r.next; 288 323 pj_ssize_t size_eaten; 289 324 290 /* Break when next node time is greater than now. */ 291 if (PJ_TIME_VAL_GTE(node->rdata.pkt_info.timestamp, now)) 292 break; 325 pj_list_erase(node); 293 326 294 327 /* Notify transport manager about the "incoming packet" */ … … 298 331 /* Must "eat" all the packets. */ 299 332 pj_assert(size_eaten == node->rdata.pkt_info.len); 300 301 /* Delete this from the list. */302 pj_list_erase(node);303 333 304 334 /* Done. */ … … 306 336 node->rdata.tp_info.pool); 307 337 } 308 309 pj_lock_release(loop->base.lock);310 338 } 311 339
Note: See TracChangeset
for help on using the changeset viewer.