Browse code

tcp_read.c: logging: DBG -> LM_DBG

Ovidiu Sas authored on 13/01/2015 14:48:36
Showing 1 changed files
... ...
@@ -275,7 +275,7 @@ again:
275 275
 					(*flags & RD_CONN_FORCE_EOF))){
276 276
 			c->state=S_CONN_EOF;
277 277
 			*flags|=RD_CONN_EOF;
278
-			DBG("EOF on %p, FD %d\n", c, fd);
278
+			LM_DBG("EOF on %p, FD %d\n", c, fd);
279 279
 		}else{
280 280
 			if (unlikely(c->state==S_CONN_CONNECT || c->state==S_CONN_ACCEPT)){
281 281
 				TCP_STATS_ESTABLISHED(c->state);
... ...
@@ -329,7 +329,7 @@ int tcp_read(struct tcp_connection *c, int* flags)
329 329
 		return -1;
330 330
 	}
331 331
 #ifdef EXTRA_DEBUG
332
-	DBG("tcp_read: read %d bytes:\n%.*s\n", bytes_read, bytes_read, r->pos);
332
+	LM_DBG("read %d bytes:\n%.*s\n", bytes_read, bytes_read, r->pos);
333 333
 #endif
334 334
 	r->pos+=bytes_read;
335 335
 	return bytes_read;
... ...
@@ -507,8 +507,7 @@ int tcp_read_headers(struct tcp_connection *c, int* read_flags)
507 507
 								p++;
508 508
 								goto skip;
509 509
 							} else {
510
-								DBG("tcp_read_headers: ERROR: no clen, p=%X\n",
511
-										*p);
510
+								LM_DBG("ERROR: no clen, p=%X\n", *p);
512 511
 								r->error=TCP_REQ_BAD_LEN;
513 512
 							}
514 513
 						}
... ...
@@ -580,8 +579,7 @@ int tcp_read_headers(struct tcp_connection *c, int* read_flags)
580 580
 							p++;
581 581
 							goto skip;
582 582
 						} else {
583
-							DBG("tcp_read_headers: ERROR: no clen, p=%X\n",
584
-									*p);
583
+							LM_DBG("ERROR: no clen, p=%X\n", *p);
585 584
 							r->error=TCP_REQ_BAD_LEN;
586 585
 						}
587 586
 					}
... ...
@@ -628,7 +626,7 @@ int tcp_read_headers(struct tcp_connection *c, int* read_flags)
628 628
 						/* body will used as pointer to the last used byte */
629 629
 							r->body=p;
630 630
 							r->content_len = 0;
631
-							DBG("stun msg detected\n");
631
+							LM_DBG("stun msg detected\n");
632 632
 						} else {
633 633
 							r->state=H_SKIP;
634 634
 						}
... ...
@@ -1286,10 +1284,10 @@ again:
1286 1286
 				bytes=tcp_read_headers(con, read_flags);
1287 1287
 #ifdef EXTRA_DEBUG
1288 1288
 						/* if timeout state=0; goto end__req; */
1289
-			DBG("read= %d bytes, parsed=%d, state=%d, error=%d\n",
1289
+			LM_DBG("read= %d bytes, parsed=%d, state=%d, error=%d\n",
1290 1290
 					bytes, (int)(req->parsed-req->start), req->state,
1291 1291
 					req->error );
1292
-			DBG("tcp_read_req: last char=0x%02X, parsed msg=\n%.*s\n",
1292
+			LM_DBG("last char=0x%02X, parsed msg=\n%.*s\n",
1293 1293
 					*(req->parsed-1), (int)(req->parsed-req->start),
1294 1294
 					req->start);
1295 1295
 #endif
... ...
@@ -1307,7 +1305,7 @@ again:
1307 1307
 			 */
1308 1308
 			if (unlikely((con->state==S_CONN_EOF) && 
1309 1309
 						(! TCP_REQ_COMPLETE(req)))) {
1310
-				DBG( "tcp_read_req: EOF\n");
1310
+				LM_DBG("EOF\n");
1311 1311
 				resp=CONN_EOF;
1312 1312
 				goto end_req;
1313 1313
 			}
... ...
@@ -1317,23 +1315,23 @@ again:
1317 1317
 					req->state, req->error,
1318 1318
 					(int)(req->pos-req->buf), req->buf,
1319 1319
 					(int)(req->parsed-req->start), req->start);
1320
-			DBG("- received from: port %d\n", con->rcv.src_port);
1321
-			print_ip("- received from: ip ",&con->rcv.src_ip, "\n");
1320
+			LM_DBG("received from: port %d\n", con->rcv.src_port);
1321
+			print_ip("received from: ip", &con->rcv.src_ip, "\n");
1322 1322
 			resp=CONN_ERROR;
1323 1323
 			goto end_req;
1324 1324
 		}
1325 1325
 		if (likely(TCP_REQ_COMPLETE(req))){
1326 1326
 #ifdef EXTRA_DEBUG
1327
-			DBG("tcp_read_req: end of header part\n");
1328
-			DBG("- received from: port %d\n", con->rcv.src_port);
1329
-			print_ip("- received from: ip ", &con->rcv.src_ip, "\n");
1330
-			DBG("tcp_read_req: headers:\n%.*s.\n",
1327
+			LM_DBG("end of header part\n");
1328
+			LM_DBG("received from: port %d\n", con->rcv.src_port);
1329
+			print_ip("received from: ip", &con->rcv.src_ip, "\n");
1330
+			LM_DBG("headers:\n%.*s.\n",
1331 1331
 					(int)(req->body-req->start), req->start);
1332 1332
 #endif
1333 1333
 			if (likely(TCP_REQ_HAS_CLEN(req))){
1334
-				DBG("tcp_read_req: content-length= %d\n", req->content_len);
1334
+				LM_DBG("content-length=%d\n", req->content_len);
1335 1335
 #ifdef EXTRA_DEBUG
1336
-				DBG("tcp_read_req: body:\n%.*s\n", req->content_len,req->body);
1336
+				LM_DBG("body:\n%.*s\n", req->content_len,req->body);
1337 1337
 #endif
1338 1338
 			}else{
1339 1339
 				if (cfg_get(tcp, tcp_cfg, accept_no_cl)==0) {
... ...
@@ -1346,7 +1344,7 @@ again:
1346 1346
 			/* if we are here everything is nice and ok*/
1347 1347
 			resp=CONN_RELEASE;
1348 1348
 #ifdef EXTRA_DEBUG
1349
-			DBG("receiving msg(%p, %d, )\n",
1349
+			LM_DBG("receiving msg(%p, %d)\n",
1350 1350
 					req->start, (int)(req->parsed-req->start));
1351 1351
 #endif
1352 1352
 			/* rcv.bind_address should always be !=0 */
... ...
@@ -1425,13 +1423,12 @@ again:
1425 1425
 				memmove(req->buf, req->parsed, size);
1426 1426
 				req->parsed=req->buf; /* fix req->parsed after using it */
1427 1427
 #ifdef EXTRA_DEBUG
1428
-				DBG("tcp_read_req: preparing for new request, kept %ld"
1429
-						" bytes\n", size);
1428
+				LM_DBG("preparing for new request, kept %ld bytes\n", size);
1430 1429
 #endif
1431 1430
 				/*if we still have some unparsed bytes, try to parse them too*/
1432 1431
 				goto again;
1433 1432
 			} else if (unlikely(con->state==S_CONN_EOF)){
1434
-				DBG( "tcp_read_req: EOF after reading complete request\n");
1433
+				LM_DBG("EOF after reading complete request\n");
1435 1434
 				resp=CONN_EOF;
1436 1435
 			}
1437 1436
 			req->parsed=req->buf; /* fix req->parsed */
... ...
@@ -1449,9 +1446,9 @@ void release_tcpconn(struct tcp_connection* c, long state, int unix_sock)
1449 1449
 {
1450 1450
 	long response[2];
1451 1451
 	
1452
-		DBG( "releasing con %p, state %ld, fd=%d, id=%d\n",
1452
+		LM_DBG("releasing con %p, state %ld, fd=%d, id=%d\n",
1453 1453
 				c, state, c->fd, c->id);
1454
-		DBG(" extra_data %p\n", c->extra_data);
1454
+		LM_DBG("extra_data %p\n", c->extra_data);
1455 1455
 		/* release req & signal the parent */
1456 1456
 		c->reader_pid=0; /* reset it */
1457 1457
 		if (c->fd!=-1){
... ...
@@ -1523,7 +1520,7 @@ inline static int handle_io(struct fd_map* fm, short events, int idx)
1523 1523
 		case F_TCPMAIN:
1524 1524
 again:
1525 1525
 			ret=n=receive_fd(fm->fd, &con, sizeof(con), &s, 0);
1526
-			DBG("received n=%d con=%p, fd=%d\n", n, con, s);
1526
+			LM_DBG("received n=%d con=%p, fd=%d\n", n, con, s);
1527 1527
 			if (unlikely(n<0)){
1528 1528
 				if (errno == EWOULDBLOCK || errno == EAGAIN){
1529 1529
 					ret=0;