Skip to content

Conversation

seanmonstar
Copy link
Member

@seanmonstar seanmonstar commented Jul 29, 2025

I was doing some debugging again, and again reminded that some of these things just print way too much worthless noise. Such as:

h2::proto::streams::streams drop_stream_ref; stream=Stream {
	id: StreamId(187),
	state: State { inner: Closed(Error(Reset(StreamId(187), REFUSED_STREAM, Remote))) },
	is_counted: false,
	ref_count: 1,
	next_pending_send: None,
	is_pending_send: false,
	send_flow: FlowControl { window_size: Window(65535), available: Window(0) },
	requested_send_capacity: 0,
	buffered_send_data: 0,
	send_task: None,
	pending_send: Deque { indices: None },
	next_pending_send_capacity: Some(Key { index: SlabIndex(94), stream_id: StreamId(189) }),
	is_pending_send_capacity: true,
	send_capacity_inc: false,
	next_open: None,
	is_pending_open: false,
	is_pending_push: false,
	next_pending_accept: None,
	is_pending_accept: false,
	recv_flow: FlowControl { window_size: Window(65535), available: Window(65535) },
	in_flight_recv_data: 0,
	next_window_update: None,
	is_pending_window_update: false,
	reset_at: None,
	next_reset_expire: None,
	pending_recv: Deque { indices: None },
	is_recv: true,
	recv_task: None,
	push_task: None,
	pending_push_promises: Queue { indices: None, _p: PhantomData<h2::proto::streams::stream::NextAccept> },
	content_length: Omitted
}

(I indented that to help myself in this PR)

The most interesting changes here are that on the Stream type, many fields are only printed if they are in an interesting state. Such as if the boolean is true, or the option is Some. This does mean that if you care about the field always being there, this will be different. But I think it's a significant improvement.

This is the revised output:

h2::proto::streams::streams drop_stream_ref; stream=Stream {
	id: StreamId(187),
	state: Closed(Error(Reset(StreamId(187), REFUSED_STREAM, Remote))),
	is_counted: false,
	ref_count: 1,
	send_flow: FlowControl { window_size: Window(65535), available: Window(0) },
	requested_send_capacity: 0,
	buffered_send_data: 0,
	next_pending_send_capacity: Some(Key { index: SlabIndex(94), stream_id: StreamId(189) }),
	is_pending_send_capacity: true,
	recv_flow: FlowControl { window_size: Window(65535), available: Window(65535) },
	in_flight_recv_data: 0,
	is_recv: true,
	content_length: Omitted
}

@seanmonstar seanmonstar requested a review from LucioFranco July 29, 2025 20:46
@seanmonstar seanmonstar merged commit c85d1e8 into master Jul 30, 2025
6 checks passed
@seanmonstar seanmonstar deleted the push-xltmtunrnmqn branch July 30, 2025 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants