Skip to content

Return True from Stream.is_closing() once the server is gone - #331

Merged
mhils merged 1 commit into
mitmproxy:mainfrom
natefinch:stream-is-closing
Oct 1, 2026
Merged

mhils merged 1 commit into
mitmproxy:mainfrom
natefinch:stream-is-closing

Conversation

@natefinch

Copy link
Copy Markdown
Contributor

Stream.is_closing() only looked at the local stream state, so it returned False after the server (or the UDP client task) had shut down, while write() then raised OSError: Server has been shut down. It now also returns True when the command channel is closed, matching asyncio.StreamWriter.

Suggested in mitmproxy/mitmproxy#8455.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0822dee1-89da-4338-994f-bf1a11052c0e

@mhils mhils left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 馃嵃

@mhils
mhils merged commit e060995 into mitmproxy:main Oct 1, 2026
23 checks passed
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