Browse code

core: cleaned debug messages and added safety check for bind address

Daniel-Constantin Mierla authored on 01/03/2015 20:16:46
Showing 1 changed files
... ...
@@ -3770,17 +3770,17 @@ inline static int send2child(struct tcp_connection* tcpconn)
3770 3770
 		if(tcpconn->rcv.bind_address->workers>0) {
3771 3771
 			wfirst = tcpconn->rcv.bind_address->workers_tcpidx;
3772 3772
 			wlast = wfirst + tcpconn->rcv.bind_address->workers;
3773
-			LM_DBG("===== checking per-socket specific workers (%d/%d..%d/%d) [%s]\n",
3773
+			LM_DBG("checking per-socket specific workers (%d/%d..%d/%d) [%s]\n",
3774 3774
 					tcp_children[wfirst].pid, tcp_children[wfirst].proc_no,
3775 3775
 					tcp_children[wlast-1].pid, tcp_children[wlast-1].proc_no,
3776
-					tcpconn->rcv.bind_address->sock_str.s);
3776
+					(tcpconn->rcv.bind_address)?tcpconn->rcv.bind_address->sock_str.s:"");
3777 3777
 		} else {
3778 3778
 			wfirst = 0;
3779 3779
 			wlast = tcp_sockets_gworkers - 1;
3780
-			LM_DBG("+++++ checking per-socket generic workers (%d/%d..%d/%d) [%s]\n",
3780
+			LM_DBG("checking per-socket generic workers (%d/%d..%d/%d) [%s]\n",
3781 3781
 					tcp_children[wfirst].pid, tcp_children[wfirst].proc_no,
3782 3782
 					tcp_children[wlast-1].pid, tcp_children[wlast-1].proc_no,
3783
-					tcpconn->rcv.bind_address->sock_str.s);
3783
+					(tcpconn->rcv.bind_address)?tcpconn->rcv.bind_address->sock_str.s:"");
3784 3784
 		}
3785 3785
 		idx = wfirst;
3786 3786
 		min_busy = tcp_children[idx].busy;
... ...
@@ -3807,7 +3807,8 @@ inline static int send2child(struct tcp_connection* tcpconn)
3807 3807
 	}
3808 3808
 	LM_DBG("selected tcp worker %d %d(%ld) for activity on [%s], %p\n",
3809 3809
 			idx, tcp_children[idx].proc_no, (long)tcp_children[idx].pid,
3810
-			tcpconn->rcv.bind_address->sock_str.s, tcpconn);
3810
+			(tcpconn->rcv.bind_address)?tcpconn->rcv.bind_address->sock_str.s:"",
3811
+			tcpconn);
3811 3812
 	/* first make sure this child doesn't have pending request for
3812 3813
 	 * tcp_main (to avoid a possible deadlock: e.g. child wants to
3813 3814
 	 * send a release command, but the master fills its socket buffer