Browse code

core: b/f: do not re-use the uac transaction iterator after onRxReplyStatus()

The transaction could possibly have been deleted in between, whereby it is unclear where.

Raphael Coeffic authored on 02/04/2014 09:53:38 • Stefan Sayer committed on 08/04/2014 12:09:37
Showing 4 changed files
... ...
@@ -358,8 +358,7 @@ void AmBasicSipDialog::onRxRequest(const AmSipRequest& req)
358 358
     hdl->onSipRequest(req);
359 359
 }
360 360
 
361
-bool AmBasicSipDialog::onRxReplyStatus(const AmSipReply& reply, 
362
-				       TransMap::iterator t_uac_it)
361
+bool AmBasicSipDialog::onRxReplyStatus(const AmSipReply& reply)
363 362
 {
364 363
   /**
365 364
    * Error code list from RFC 5057:
... ...
@@ -448,15 +447,18 @@ void AmBasicSipDialog::onRxReply(const AmSipReply& reply)
448 447
   updateDialogTarget(reply);
449 448
   
450 449
   Status saved_status = status;
451
-  if(onRxReplyStatus(reply,t_it) && hdl)
452
-    hdl->onSipReply(t_it->second,reply,saved_status);
450
+  AmSipRequest orig_req(t_it->second);
451
+
452
+  if(onRxReplyStatus(reply) && hdl) {
453
+    hdl->onSipReply(orig_req,reply,saved_status);
454
+  }
453 455
 
454 456
   if((reply.code >= 200) && // final reply
455 457
      // but not for 2xx INV reply (wait for 200 ACK)
456 458
      ((reply.cseq_method != SIP_METH_INVITE) ||
457 459
       (reply.code >= 300))) {
458 460
        
459
-    uac_trans.erase(t_it);
461
+    uac_trans.erase(reply.cseq);
460 462
   }
461 463
 }
462 464
 
... ...
@@ -183,8 +183,7 @@ protected:
183 183
    *
184 184
    * @return true to continue processing, false otherwise
185 185
    */
186
-  virtual bool onRxReplyStatus(const AmSipReply& reply, 
187
-			       TransMap::iterator t_uac_it);
186
+  virtual bool onRxReplyStatus(const AmSipReply& reply);
188 187
 
189 188
   /**
190 189
    * Terminate pending UAS transactions
... ...
@@ -332,8 +332,7 @@ void AmSipDialog::onRequestTxed(const AmSipRequest& req)
332 332
   }
333 333
 }
334 334
 
335
-bool AmSipDialog::onRxReplyStatus(const AmSipReply& reply, 
336
-				  TransMap::iterator t_uac_it)
335
+bool AmSipDialog::onRxReplyStatus(const AmSipReply& reply)
337 336
 {
338 337
   // rfc3261 12.1
339 338
   // Dialog established only by 101-199 or 2xx 
... ...
@@ -68,7 +68,7 @@ protected:
68 68
   bool onRxReqSanity(const AmSipRequest& req);
69 69
   bool onRxReqStatus(const AmSipRequest& req);
70 70
 
71
-  bool onRxReplyStatus(const AmSipReply& reply, TransMap::iterator t_uac_it);
71
+  bool onRxReplyStatus(const AmSipReply& reply);
72 72
 
73 73
 
74 74
  public: