Browse code

small fixes

- add a build debugging mode (to just exclude, for now, the -O2 - makes g++
much slower)
- onNoPrack's signature updated in registrar client
- log errors when unable to send a message (besides a bunch of debugs, some of
which should be warnings, actually)

bpi authored on 01/07/2010 18:57:52
Showing 5 changed files
... ...
@@ -86,6 +86,9 @@ USE_MONITORING=yes
86 86
 #
87 87
 #LONG_DEBUG_MESSAGE=yes
88 88
 
89
+# Is this a debug build or not?
90
+debug=no
91
+
89 92
 
90 93
 ################### end of configuration section #######################
91 94
 
... ...
@@ -157,11 +160,14 @@ CXX = g++
157 160
 CC = gcc
158 161
 LD = $(CC)
159 162
 
163
+CXXFLAGS += -Wall -Wno-reorder -fPIC -g $(EXTRA_CXXFLAGS)
164
+CFLAGS   += -Wall -fPIC -g $(EXTRA_CFLAGS)
160 165
 
161
-CXXFLAGS += -Wall -Wno-reorder -fPIC -g \
162
-	    -O2 $(EXTRA_CXXFLAGS)
163
-         
164
-CFLAGS += -Wall -fPIC -g -O2 $(EXTRA_CFLAGS)
166
+# only optimize if releasing, as it slows down the build process
167
+ifneq ($(debug),yes)
168
+	CXXFLAGS += -O2
169
+	CFLAGS += -O2
170
+endif
165 171
 
166 172
 ifeq ($(DEBUG_PLAYOUT), yes)
167 173
 CPPFLAGS +=  -DDEBUG_PLAYOUTBUF
... ...
@@ -109,7 +109,8 @@ void SIPRegistration::doRegistration()
109 109
     //else 
110 110
     //    dlg.outbound_proxy = "";
111 111
     
112
-    dlg.sendRequest(req.method, "", "", "Expires: 1000\n");
112
+    if (dlg.sendRequest(req.method, "", "", "Expires: 1000\n") < 0)
113
+      ERROR("failed to send registration.\n");
113 114
     
114 115
     // save TS
115 116
     struct timeval now;
... ...
@@ -133,7 +134,8 @@ void SIPRegistration::doUnregister()
133 134
     //else 
134 135
     //    dlg.outbound_proxy = "";
135 136
     
136
-    dlg.sendRequest(req.method, "", "", "Expires: 0\n");
137
+    if (dlg.sendRequest(req.method, "", "", "Expires: 0\n") < 0)
138
+      ERROR("failed to send deregistration.\n");
137 139
 
138 140
     // save TS
139 141
     struct timeval now;
... ...
@@ -132,7 +132,7 @@ class SIPRegistration : public AmSipDialogEventHandler,
132 132
   void onNoErrorACK(unsigned int) {}
133 133
 #else
134 134
   void onNoAck(unsigned int) {}
135
-  void onNoPrack(unsigned int) {}
135
+  void onNoPrack(const AmSipRequest &, const AmSipReply &) {}
136 136
 #endif
137 137
 
138 138
   /** is this registration registered? */
... ...
@@ -186,7 +186,7 @@ void AmB2ABCallerSession::onB2ABEvent(B2ABEvent* ev)
186 186
 
187 187
   case B2ABConnectOtherLegException:
188 188
   case B2ABConnectOtherLegFailed: {
189
-    DBG("looks like callee leg could not be created. terminating our leg.\n");
189
+    WARN("looks like callee leg could not be created. terminating our leg.\n");
190 190
     terminateLeg();
191 191
     callee_status = None;
192 192
     return;
... ...
@@ -362,7 +362,8 @@ void AmB2ABCalleeSession::onSipReply(const AmSipReply& rep, int old_dlg_status)
362 362
   if ((status_before == AmSipDialog::Pending)&&
363 363
       (status == AmSipDialog::Disconnected)) {
364 364
 	  
365
-    DBG("callee session creation failed. notifying callersession.\n");
365
+    DBG("callee session creation failed. notifying caller session.\n");
366
+    DBG("this happened with reply: %d.\n", rep.code);
366 367
     relayEvent(new B2ABConnectOtherLegFailedEvent(rep.code, rep.reason));
367 368
 
368 369
   } else if ((status == AmSipDialog::Pending) && (rep.code == 180)) {
... ...
@@ -164,15 +164,18 @@ bool UACAuth::onSipReply(const AmSipReply& reply)
164 164
 	    if (dlg->sendRequest(ri->second.method,
165 165
 				 ri->second.content_type,
166 166
 				 ri->second.body, 
167
-				 hdrs) == 0) 			
167
+				 hdrs) == 0) {
168 168
 	      processed = true;
169
+              DBG("authenticated request successfully sent.\n");
170
+            } else {
171
+              ERROR("failed to send authenticated request.\n");
172
+            }
169 173
 	  }
170 174
 	} 
171 175
       }
172
-  }
173
-	
174
-  if (reply.code >= 200)
176
+  } else if (reply.code >= 200) {
175 177
     sent_requests.erase(reply.cseq); // now we dont need it any more
178
+  }
176 179
 	
177 180
   return processed;
178 181
 }