h2olog: fix the scoping issue
@@ -100,12 +100,6 @@ def usage():
exit()
def trace_http(pid):
- u = USDT(pid=int(pid))
- u.enable_probe(probe="receive_request", fn_name="trace_receive_req")
- u.enable_probe(probe="receive_request_header", fn_name="trace_receive_req_header")
- u.enable_probe(probe="send_response", fn_name="trace_send_resp")
-
- b = BPF(text=bpf, usdt_contexts=[u])
b["rxbuf"].open_perf_buffer(handle_req_line)
b["txbuf"].open_perf_buffer(handle_resp_line)
@@ -115,7 +109,7 @@ def trace_http(pid):
except KeyboardInterrupt:
exit()
-if len(sys.argv) == 0:
+if len(sys.argv) < 1:
usage()
try:
@@ -131,4 +125,11 @@ except getopt.error as msg:
if h2o_pid == 0:
usage()
+u = USDT(pid=int(h2o_pid))
+if sys.argv[1] != "quic":
+ u.enable_probe(probe="receive_request", fn_name="trace_receive_req")
+ u.enable_probe(probe="receive_request_header", fn_name="trace_receive_req_header")
+ u.enable_probe(probe="send_response", fn_name="trace_send_resp")
+
+b = BPF(text=bpf, usdt_contexts=[u])
trace_http(h2o_pid)
