Repository navigation
Conversation
| # control. A TCP EOF is not an SSL close_notify. | ||
| self._tcp_eof_received = True | ||
| self._do_read() | ||
| return self._state == WRAPPED |
There was a problem hiding this comment.
I'm a little confused as to why we have a double check going on here does it have to do with updating the state after _do_read?
There was a problem hiding this comment.
Yes. The first check decides whether to drain TLS data, but _do_read() can move the protocol out of WRAPPED if shutdown starts or completes. The second check tells the TCP transport to stay open only if there's still buffered TLS data to drain. I added a comment to make that distinction clear.
There was a problem hiding this comment.
@itisrmk Alright ^^ I'll mark this as resolved.
Vizonex
left a comment
There was a problem hiding this comment.
There's just one small thing bothering me before I can approve this PR.
Vizonex
left a comment
There was a problem hiding this comment.
@itisrmk Don't worry about ubuntu 3.9 btw there is a change comming for that that I am waiting on fantix to try and merge. I approve this Pull request. Just know that windows support is coming and I've been moving winloop to uvloop so that I can help maintain uvloop as a whole and I don't know how some of these changes will behave long term. But I will let you know whenever I see something change.
Fixes #792.
When a TLS peer closes TCP while application reads are paused, keep the transport alive long enough to deliver buffered plaintext after reads resume. A bare TCP EOF still does not count as a TLS
close_notify. The regression covers both ordinary and buffered protocols. The existing shutdown test now explicitly closes the client to preserve its check that an application close discards trailing data.The regression previously failed with
AssertionError: 0 != 20480. After rebuilding the extension, the TCP/SSL suite passes (118 tests, 21 skipped) on CPython 3.12/Linux.AI disclosure: Devin drafted the patch and regression test.