Module: sems
Branch: master
Commit: a3f143525f7b964bb1f146b2fcb080ecf467e73a
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=a3f143525f7b964bb1f146b2fcb080ecf467e73a

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Wed Jan 11 12:37:29 2012 +0100

b/f: DSM: mod_dlg: check last_request only when necessary

---

 apps/dsm/mods/mod_dlg/ModDlg.cpp |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/apps/dsm/mods/mod_dlg/ModDlg.cpp b/apps/dsm/mods/mod_dlg/ModDlg.cpp
index 21d0b65..51aeb6f 100644
--- a/apps/dsm/mods/mod_dlg/ModDlg.cpp
+++ b/apps/dsm/mods/mod_dlg/ModDlg.cpp
@@ -57,7 +57,7 @@ bool DLGModule::onInvite(const AmSipRequest& req, DSMSession* 
sess) {
   // save inivital invite to last_req 
   // todo: save this in avar
  sess->last_req.reset(new AmSipRequest(req));
-  return true;
+ return true;
 }
 
 // todo: convert errors to exceptions
@@ -74,13 +74,6 @@ void replyRequest(DSMSession* sc_sess, AmSession* sess,
     return;
   }
 
-  if (!sc_sess->last_req.get()) {
-    ERROR("no last request to reply\n");
-    sc_sess->SET_ERRNO(DSM_ERRNO_GENERAL);
-    sc_sess->SET_STRERROR("no last request to reply");
-    return;
-  }
-
   if (sess->dlg.reply(req, code_i, reason)) {
     sc_sess->SET_ERRNO(DSM_ERRNO_GENERAL);
     sc_sess->SET_STRERROR("error sending reply");
@@ -90,6 +83,14 @@ void replyRequest(DSMSession* sc_sess, AmSession* sess,
 
 CONST_ACTION_2P(DLGReplyAction, ',', true);
 EXEC_ACTION_START(DLGReplyAction) {
+
+  if (!sc_sess->last_req.get()) {
+    ERROR("no last request to reply\n");
+    sc_sess->SET_ERRNO(DSM_ERRNO_GENERAL);
+    sc_sess->SET_STRERROR("no last request to reply");
+    return;
+  }
+
   replyRequest(sc_sess, sess, event_params, par1, par2, 
*sc_sess->last_req.get());
 } EXEC_ACTION_END;
 

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to