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

Author: Stefan Sayer <[email protected]>
Committer: Stefan Sayer <[email protected]>
Date:   Tue Dec 28 00:57:20 2010 +0100

optimization saving some dynamic_cast

---

 core/AmB2BSession.cpp |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/core/AmB2BSession.cpp b/core/AmB2BSession.cpp
index d18c94d..7de5fbf 100644
--- a/core/AmB2BSession.cpp
+++ b/core/AmB2BSession.cpp
@@ -595,18 +595,20 @@ int AmB2BCallerSession::relayEvent(AmEvent* ev)
 {
   if(other_id.empty()){
 
-    if(dynamic_cast<B2BEvent*>(ev)){
-
-      B2BSipEvent*     sip_ev = dynamic_cast<B2BSipEvent*>(ev);
-      B2BConnectEvent* co_ev  = dynamic_cast<B2BConnectEvent*>(ev);
-           
-      if( (sip_ev && sip_ev->forward) || co_ev ) {
-       createCalleeSession();
-       if (other_id.length()) {
-         MONITORING_LOG(getLocalTag().c_str(), "b2b_leg", other_id.c_str());
-       }
+    bool create_callee = false;
+    B2BSipEvent* sip_ev = dynamic_cast<B2BSipEvent*>(ev);
+    if (sip_ev && sip_ev->forward)
+      create_callee = true;
+    else
+      create_callee = dynamic_cast<B2BConnectEvent*>(ev) != NULL;
+
+    if (create_callee) {
+      createCalleeSession();
+      if (other_id.length()) {
+       MONITORING_LOG(getLocalTag().c_str(), "b2b_leg", other_id.c_str());
       }
     }
+
   }
 
   return AmB2BSession::relayEvent(ev);

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

Reply via email to