Browse Source

tls: tls.list rpc: fix timeout & ip display

- fix ip address display
- fix timeout computation
Andrei Pelinescu-Onciul 15 years ago
parent
commit
1ea3a8c784
1 changed files with 7 additions and 7 deletions
  1. 7 7
      modules/tls/tls_rpc.c

+ 7 - 7
modules/tls/tls_rpc.c

@@ -116,15 +116,15 @@ static void tls_list(rpc_t* rpc, void* c)
 			tls_d = con->extra_data;
 			tls_d = con->extra_data;
 			rpc->add(c, "{", &handle);
 			rpc->add(c, "{", &handle);
 			/* tcp data */
 			/* tcp data */
-			if (ip_addr2sbuf(&con->rcv.src_ip, src_ip, sizeof(src_ip)) == 0) {
+			if ((len = ip_addr2sbuf(&con->rcv.src_ip, src_ip, sizeof(src_ip)))
+					== 0)
 				BUG("failed to convert source ip");
 				BUG("failed to convert source ip");
-				src_ip[0]=0;
-			}
-			if (ip_addr2sbuf(&con->rcv.dst_ip, dst_ip, sizeof(dst_ip)) == 0) {
+			src_ip[len] = 0;
+			if ((len = ip_addr2sbuf(&con->rcv.dst_ip, dst_ip, sizeof(dst_ip)))
+					== 0)
 				BUG("failed to convert destination ip");
 				BUG("failed to convert destination ip");
-				dst_ip[0]=0;
-			}
-			timeout = TICKS_TO_S(con->timeout - get_ticks());
+			dst_ip[len] = 0;
+			timeout = TICKS_TO_S(con->timeout - get_ticks_raw());
 			rpc->struct_add(handle, "ddsdsd",
 			rpc->struct_add(handle, "ddsdsd",
 					"id", con->id,
 					"id", con->id,
 					"timeout", timeout,
 					"timeout", timeout,