Browse code

core: drop reply ser compatibility

- drop reply also if ret==0, not only on DROP
(e.g. modules function returning 0). This preserves
compatibility with old scripts.
- uncomment the onreply_route error handling. It was commented out
by the last commit
(0621319 core: drop reply in K compatible style). To disable it,
define NO_ONREPLY_ROUTE_ERROR.

Andrei Pelinescu-Onciul authored on 01/02/2010 11:06:08
Showing 1 changed files
... ...
@@ -230,14 +230,14 @@ int receive_msg(char* buf, unsigned int len, struct receive_info* rcv_info)
230 230
 		if (onreply_rt.rlist[DEFAULT_RT]){
231 231
 			set_route_type(ONREPLY_ROUTE);
232 232
 			ret=run_top_route(onreply_rt.rlist[DEFAULT_RT], msg, &ctx);
233
-#if 0
234
-			if (ret<0){
233
+#ifndef NO_ONREPLY_ROUTE_ERROR
234
+			if (unlikely(ret<0)){
235 235
 				LOG(L_WARN, "WARNING: receive_msg: "
236 236
 						"error while trying onreply script\n");
237 237
 				goto error_rpl;
238 238
 			}else
239
-#endif
240
-			if (ctx.run_flags&DROP_R_F){
239
+#endif /* NO_ONREPLY_ROUTE_ERROR */
240
+			if (unlikely(ret==0 || (ctx.run_flags&DROP_R_F))){
241 241
 				goto skip_send_reply; /* drop the message, no error */
242 242
 			}
243 243
 		}
... ...
@@ -269,13 +269,13 @@ end:
269 269
 	if (skipped) STATS_RX_DROPS;
270 270
 #endif
271 271
 	return 0;
272
-#if 0
272
+#ifndef NO_ONREPLY_ROUTE_ERROR
273 273
 error_rpl:
274 274
 	/* execute post reply-script callbacks */
275 275
 	exec_post_script_cb(msg, ONREPLY_CB_TYPE);
276 276
 	reset_avps();
277 277
 	goto error02;
278
-#endif
278
+#endif /* NO_ONREPLY_ROUTE_ERROR */
279 279
 error_req:
280 280
 	DBG("receive_msg: error:...\n");
281 281
 	/* execute post request-script callbacks */